Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it L'avatar di fedrock
    Registrato dal
    Jun 2009
    residenza
    Milan
    Messaggi
    342

    [VB.NET 08]Come spostare un form con nessuna barra del titolo

    Praticamente se metto None in FormBorderStyle non si può muovere la form , sapete come posso risolvere?

  2. #2
    Utente di HTML.it L'avatar di gibra
    Registrato dal
    Apr 2008
    residenza
    Italy
    Messaggi
    4,244
    Devi usare il subclassing, utilizzando il metodo WndProc, per fare 'credere' a Windows che hai fatto clic sulla barra del titolo (HTCAPTION) invece stai usando l'area client HTCLIENT.



    codice:
    Public Class Form1
    
        Const WM_NCHITTEST As Long = &H84
        Const HTCAPTION As Long = 2
        Const HTCLIENT As Long = 1
    
    
        Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
            MyBase.WndProc(m)
            Select Case m.Msg
                Case WM_NCHITTEST
                    If m.Result.ToInt32 = HTCLIENT Then
                        m.Result = New IntPtr(HTCAPTION)
                    End If
            End Select
        End Sub
    
        Private Sub btnChiudi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChiudi.Click
            Me.Close()
        End Sub
    End Class


  3. #3
    Utente di HTML.it L'avatar di fedrock
    Registrato dal
    Jun 2009
    residenza
    Milan
    Messaggi
    342
    Funziona Grazie sei un genio

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.