0

I often use FormBorderStyle = SizableToolWindow with forms on smaller resolution displays (ie netbooks) for the smaller title-bar height and border sizes.

The MaximimizeBox and MinimizeBox properties are also set to True however it appears they are ignored because only the Close button is displayed.

I have also tried the customizing the window style using the following:

protected override CreateParams CreateParams
{
    get
    {

        CreateParams cp = base.CreateParams;



        cp.Style |= 0x00020000; // Turn on Minimize button

        cp.Style |= 0x00010000; // Turn on Maximize button

        return cp;
    }
}

But the Maximize and Minimize buttons are still not shown.

Sizable tool windows are actually shown in the taskbar by default, and can be minimized/maximized by right clicking on the taskbar icon, but this is far less convenient then just showing the buttons on the title-bar as usual.

Any suggestions?

Ash
  • 60,973
  • 31
  • 151
  • 169

4 Answers4

2

Windows simply doesn't support it, you can't force it to do otherwise. Fwiw, it isn't your job to force a window style on a netbook machine. The user does this through the Control Panel Display + Appearance tab. It is best to avoid pushing your personal preference on your UI when the user can easily do so herself. And make it consistent for all apps. And keep the min/max buttons.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Sorry I disagree. I'm not forcing some weird window style at all. Tool windows are very familiar style (seen in numerous apps) used when trying to reduce the screen "real-estate" covered by a window. All I am asking is how to let the user minimize and maximize a tool window without needing to go to the task-bar. By the way the user cannot change a tool window to a normal window using the control panel. It is application controlled, not OS controlled. – Ash Jan 03 '10 at 15:17
  • I didn't expect you to. The user can change the height of the caption bar of a normal window in the Display applet. Using a normal window instead of a tool window is thus advisable. – Hans Passant Jan 03 '10 at 15:34
  • Let me clarify. The tool window FormBorderStyle are specifically designed to use for less obtrusive windows. It's completely valid and acceptable to use both normal windows and tool windows in an application. Displaying a tool window without min/max buttons is often inconvenient and confusing to a user so I cannot do this for every form. However if these buttons can be displayed, there would be no reason the user could not be given an option (within the application) to use "smaller windows". – Ash Jan 03 '10 at 15:55
0

Short of implementing a custom title bar and non-client area, you can't do it. As nobugz says, that combination of styles simply isn't supported by Windows. You could roll your own min/max buttons on top of the standard toolwindow title bar, but I don't recommend it.

ChrisV
  • 3,363
  • 16
  • 19
  • I've taken that route in the past, it would be handy if it were built-in. I guess I would really like to know why the MinimizeBox / MaximizeBox properties are ignored considering a Tool window *can* be maximized/minimized. – Ash Jan 03 '10 at 15:20
0

You can let FormBorderStyle be FixedDialog and then set MaximizeBox to False. This will leave only the Minimize and Close buttons active in the upper left of the app window.

0

For those seeing a windows forms solutions in the latest version of visual studio where they don't want to resize the form and allow minimum, set FormBorderStyle to FixedDialog to fix the size, and then set MaximumSize to the the same size as your main size. This gives you max and min icons, and keeps the form the same size.

Spinstaz
  • 287
  • 6
  • 12