Visually remove/disable close button from title bar .NET

前端 未结 13 994
后悔当初
后悔当初 2020-12-03 21:51

I have been asked to remove or disable the close button from our VB .NET 2005 MDI application. There are no native properties on a form that allow you to grey out the close

13条回答
  •  不知归路
    2020-12-03 22:35

    Prevent to close the form, but hide it:

    Private Sub Form1_Closing(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        Me.WindowState = FormWindowState.Minimized 
        Me.Visible=false
        e.Cancel = True
    End Sub
    

提交回复
热议问题