tags:

views:

221

answers:

2

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?

+1  A: 

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
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
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
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
A: 

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
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