How can I turn off the ControlBox but still have Close in the upper right of a form?

M

Michael Howes

I know I've done this in the past but can't remember how I did it.
How can I turn off the ControlBox but still have the Close X in the upper
right of a Form?

It's some combo of FixedDialog and ControlBox = false

thanks
mike
 
R

Rodger Constandse

If you set the FormBorderStyle to FixedDialog and leave the ControlBox set to
true, the dialog should show the Close X but not the "Control Box".

In the particular Form that I checked I also had the MaximizeBox/MinimizeBox
properties set to false and ShowInTaskbar was also set to false.

I've noticed in the past that for some of my dialogs, sometimes the Control Box
shows in the designer but not when you run the app.

Hope this helps
 
T

Tim Wilson

If you're just looking to remove the min and max buttons, then you could set
the MaximizeBox and MinimixeBox properties to false.
 
H

Herfried K. Wagner [MVP]

Michael Howes said:
I know I've done this in the past but can't remember how I did it.
How can I turn off the ControlBox but still have the Close X in the upper
right of a Form?

It's some combo of FixedDialog and ControlBox = false

Set 'FormBorderStyle' to 'FixedDialog', 'MaximizeBox' and 'MinimizeBox' to
'False'. At runtime set the form's 'Icon' property to 'Nothing'/'null'.
 
M

Michael Howes

I've noticed in the past that for some of my dialogs, sometimes the
Control Box shows in the designer but not when you run the app.

this is exactly what was happening. Ugh...I had forgotten..that bug has
been in the designer for a long time

mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top