Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2003
    Messaggi
    113

    [VB.NET] Disattivare la "X"

    Vorrei disattivare la X di chiusura del form...

    Come faccio?

    Grazie1000
    ....

  2. #2
    Utente di HTML.it L'avatar di junx
    Registrato dal
    May 2004
    Messaggi
    322
    codice:
        Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Integer, ByVal revert As Integer) As Integer
    
        Private Declare Function EnableMenuItem Lib "user32" (ByVal menu As Integer, ByVal ideEnableItem As Integer, ByVal enable As Integer) As Integer
    
        Private Const SC_CLOSE As Integer = &HF060
    
        Private Const MF_BYCOMMAND As Integer = &H0
    
        Private Const MF_GRAYED As Integer = &H1
    
        Private Const MF_ENABLED As Integer = &H0
    
        Public Sub DisableFormCloseButton(ByVal form As System.Windows.Forms.Form)
    
            ' The return value specifies the previous state of the menu item (it is either
    
            ' MF_ENABLED or MF_GRAYED). 0xFFFFFFFF indicates that the menu item does not exist.
    
            Select Case EnableMenuItem(GetSystemMenu(form.Handle.ToInt32, 0), SC_CLOSE, MF_BYCOMMAND Or MF_GRAYED)
    
                Case MF_ENABLED
    
                Case MF_GRAYED
    
                Case &HFFFFFFFF
    
                    Throw New Exception("The Close menu item does not exist.")
    
                Case Else
    
            End Select
    
        End Sub
    
        Public Sub EnableFormCloseButton(ByVal form As System.Windows.Forms.Form)
            EnableMenuItem(GetSystemMenu(form.Handle.ToInt32, 0), SC_CLOSE, MF_BYCOMMAND)
        End Sub

  3. #3
    Utente di HTML.it
    Registrato dal
    Oct 2003
    Messaggi
    113
    Ti ringrazio
    ....

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.