Brothers Inserito: 25 agosto 2005 Segnala Inserito: 25 agosto 2005 Qualcuno sa come si fa a Togliere il MaxButton a una frmMain in VB
Cesco Inserita: 25 agosto 2005 Segnala Inserita: 25 agosto 2005 Ciao Brothers,se devi solo disabilitarlo, devi impostare a "False" la proprietà "MaxButton" del form stesso.Se invece vuoi eliminarlo...allora, per come ho sempre fatto io (poi magari esiste un metodo diverso...)devi impostare a "False" sia la proprietà "MaxButton" che la "MinButton": in questo modo spariranno sia il pulsante di minimizza, che quello di maximizza.Ciao,Cesco.
cdc Inserita: 25 agosto 2005 Segnala Inserita: 25 agosto 2005 Non mi ricordo se esiste una proprietà specifica del form.Mi ricordo che l'ho fatto anche con le API di Windows (però non mi ricordo + il nome).Ciao
Brothers Inserita: 25 agosto 2005 Autore Segnala Inserita: 25 agosto 2005 Non esiste una proprietà specifica nel mio frmMain.Se no era piuttosto semplice. Ho espresso male la domanda.Volevo sapere come si fa a togliere il MaxButton col codice scritto ad una frmMain dove non esiste una proprietà specifica .Ciao
Livio Orsini Inserita: 25 agosto 2005 Segnala Inserita: 25 agosto 2005 Forse non riesci a spiegarti. Se hai un form qualsiasi (nel tuo caso Main) devi avere anche NaxButton.E' sufficiente che tu, in una qualsiasi sub o function scriva "Main. " e istantaneamente ti apparirà il menù a tendina con tutte le proprietà e metodi collegati. Se poi scrivi "Main.M" il menù si posiziona automaticamente sulla posizionerà sulla voce MaxButton
dago_ Inserita: 25 agosto 2005 Segnala Inserita: 25 agosto 2005 'Crea un form con due pulsanti e incolla questo codiceOption Explicit Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long Private Const WS_MAXIMIZEBOX As Long = &H10000 Private Const GWL_STYLE As Long = (-16) Private Const SWP_FRAMECHANGED As Long = &H20 Private Const SWP_NOMOVE As Long = &H2 Private Const SWP_NOSIZE As Long = &H1 Private Sub Command1_Click() Dim lngStyle As Long 'get the current window style lngStyle = GetWindowLong(Me.hWnd, GWL_STYLE) 'set the style to disable the max button lngStyle = lngStyle And Not WS_MAXIMIZEBOX 'set the window style SetWindowLong Me.hWnd, GWL_STYLE, lngStyle 'update the window SetWindowPos Me.hWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED Or SWP_NOMOVE Or SWP_NOSIZE End Sub Private Sub Command2_Click() Dim lngStyle As Long 'get the current window style lngStyle = GetWindowLong(Me.hWnd, GWL_STYLE) 'set the style to enable the max button lngStyle = lngStyle Or WS_MAXIMIZEBOX 'set the window style SetWindowLong Me.hWnd, GWL_STYLE, lngStyle 'update the window SetWindowPos Me.hWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED Or SWP_NOMOVE Or SWP_NOSIZE End Sub
Brothers Inserita: 26 agosto 2005 Autore Segnala Inserita: 26 agosto 2005 Si, non mi spiegavo bene in effetti dimenticavo di dire che il mio form è una MDIForm e nel menù la voce MaxButton non vuole saperne di comparire , forse (Sicuramente )sbaglio qualcosa.Comunque grazie E grazie mille ancora una volta a dago_ per l'ottimo codice che mi risolve il problema in pieno
Messaggi consigliati
Crea un account o accedi per commentare
Devi essere un utente per poter lasciare un commento
Crea un account
Registrati per un nuovo account nella nostra comunità. è facile!
Registra un nuovo accountAccedi
Hai già un account? Accedi qui.
Accedi ora