Reputation: 3654
I have a Winforms application, which I'm able to minimize by clicking on the corresponding button on the top right of the window; I can then maximize it by clicking on this application's taskbar icon.
My problem is that if the window is maximized, it should be minimized when I click on the taskbar icon again, and it's currently not happening.
How can I make this behavior happen? I don't want to have to use NotifyIcon or system tray.
Upvotes: 2
Views: 3229
Reputation: 73
const int WS_MINIMIZEBOX = 0x20000;
const int CS_DBLCLKS = 0x8;
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.Style |= WS_MINIMIZEBOX;
cp.ClassStyle |= CS_DBLCLKS;
return cp;
}
}
Upvotes: 7
Reputation: 4938
You can do it with no borders too.. requires additional coding
Upvotes: 0
Reputation: 574
Try to check what's going on in LocationChanged
, Move
, RegionChanged
, Resize
, ResizeBegin
, ResizeEnd
, SizeChanged
events. Could be that some code in any of these events is blocking the behavior you described.
I am not seeing the described problem on a new empty form.
Update: I am using Window 7 Pro.
Upvotes: -1