Creating a .NET app that “docks” to the side of the screen and limits other windows' sizes when maximized

后端 未结 1 2005
攒了一身酷
攒了一身酷 2021-01-21 10:39

I got an interesting request from the higher ups. They want a simple app that will show on users\' computers to display the time in multiple time zones. That, in itself, is triv

相关标签:
1条回答
  • 2021-01-21 10:54

    As an epitaph, since Hans Passant seems reticent to post answers, I found that what I needed was to make the app an "Application Desktop Toolbar", or Appbar. The CodePlex link Hans gave, http://codeproject.com/KB/dotnet/AppBar.aspx, as well as the MSDN article on the topic, http://msdn.microsoft.com/en-us/library/windows/desktop/cc144177%28v=vs.85%29.aspx, give a lot of information. I was able to pretty much copy/paste the region of code from CodePlex defining the AppBar behavior into an otherwise normal .NET form, to create a simple proof-of-concept:

    enter image description here

    The one change I made from the CodePlex code was to sever the half of RegisterBar() that registers the form as an AppBar from the code that tears it down, so a call to RegisterBar() always does exactly that instead of alternately registering and un-registering it.

    0 讨论(0)
提交回复
热议问题