Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

I need to disable the form's context menu, when you right click on a form's caption bar a context menu appear.

Please see my snapshot.

How to do that in VB.NET?

Thank you.

Posted (edited)

You could set the Form's ControlBox property to false. That would completely remove the context menu. Is it important to still display the disabled close button?

 

To do that you need to add this :

 

    Private Const CP_NOCLOSE_BUTTON As Integer = &H200

   Protected Overrides ReadOnly Property CreateParams() As CreateParams
       Get
           Dim myCp As CreateParams = MyBase.CreateParams
           myCp.ClassStyle = myCp.ClassStyle Or CP_NOCLOSE_BUTTON
           Return myCp
       End Get
   End Property

Edited by orca44

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...