Minimize button for winforms form with sizabletoolwindow style

Any tips on how to simulate a minimize button and behavior

UPDATE - the minimize button should be on the title bar, since the screen real estate is @ premium

+4
source share
4 answers

Probably the best thing you are going to do is to keep track of what some others have done and set it up as you need. This question has been asked before, and there are good starting points here . The main process: you need to override WndProc to catch the message when the title bar is drawn, moved, etc. Then you can add your own drawing method. The real problem you will have to face is all the code you need to write so that your custom button matches the current Windows theme. In the end, you really have to rethink the design of your form to incorporate functionality elsewhere.

+6
source

From your window, make a button with the code:

 this.WindowState = FormWindowState.Minimized; 
0
source

I donโ€™t think you can, and I donโ€™t think you want it. Windows installed on SizableToolWindow or FixedToolWindow does not appear on the taskbar, therefore, as soon as you minimize it, the user will not be able to restore it. That is why there is no decrease button in the tool window.

What you probably want to do here is use the FixedDialog window with the MaximizeBox property set to false . This form can be minimized and restored, but not maximized or altered in any way (and also does not have an icon, if that matters).

0
source

I offer you the method described by BigJason and solve the problem using a drawing with a controlrenderer that would draw the correct windowstheme button.

public static void DrawCaptionButton (graphic, int x, int y, int width, int height, CaptionButton button, ButtonState state); Type declaration: System.Windows.Forms.ControlPaint Build: System.Windows.Forms, Version = 2.0.0.0

0
source

Source: https://habr.com/ru/post/1305624/


All Articles