How to disable one of the control boxes in a form?

A

Andrew

Hello, friends,

As you know, there are 3 control boxes in a window form to allow users to
minimize/maximize/close the form. How can we disable one of them and leave
the others to work as usual?

Any snipet? Thanks.
 
P

Phil Wilson

The form's properties include MaximizeBox and MinimizeBox that you can set
True or False, but I believe you'll always get the X.
 
R

rhaazy

Thanks, Phil. But, actually, X is the one we really need.






- Show quoted text -

There is a setting to disable any or all of the controls you speak
of. Just have to find it. I believe disabling the X has something to
do with the window style.
 
C

Collin

So, you want to disable the X on the form? I don't believe you can
disable it. But you can change it's behavior. For example, if a user
clicks the X, you can minimize the application to the taskbar or
system tray. Is that what you would like to accomplish?
 
H

Herfried K. Wagner [MVP]

Andrew said:
Thanks, Phil. But, actually, X is the one we really need.

\\\
Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
Const CS_DBLCLKS As Int32 = &H8
Const CS_NOCLOSE As Int32 = &H200
cp.ClassStyle = CS_DBLCLKS Or CS_NOCLOSE
Return cp
End Get
End Property
///
 

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