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

  • Thread starter Thread starter Andrew
  • Start date Start date
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.
 
The form's properties include MaximizeBox and MinimizeBox that you can set
True or False, but I believe you'll always get the X.
 
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.
 
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?
 
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
///
 
Back
Top