Simulare il posizionamento di alcuni ToolButton sulla barra del titolo della finestra

Da Gambas-it.org - Wikipedia.
Versione del 16 lug 2024 alle 21:04 di Vuott (Discussione | contributi) (Creata pagina con " Private x As Short Private y As Short Private wn As Window Private w As Watcher Private tb As ToolButton Private ta As TextArea Public Sub _n...")

(diff) ← Versione meno recente | Versione attuale (diff) | Versione più recente → (diff)
   Private x As Short
   Private y As Short
   Private wn As Window
   Private w As Watcher
   Private tb As ToolButton
   Private ta As TextArea
    
   Public Sub _new()
     
     With wn = New Window As "Wndw"
       .W = Me.W
       .H = 40
       .X = (Screen.AvailableWidth / 2) - (.W / 2)
       .Y = (Screen.AvailableHeight / 4) - (.H / 2)
       .Border = Border.None
       .Background = &D9D9D9
       .Show
     End With
     With Me
       .X = wn.X
       .Y = wn.Y + wn.H
       .Border = Border.None
       .Margin = True
       .Padding = 5
       .Arrangement = Arrange.Fill
     End With
     
     For b As Byte = 1 To 4
       With tb = New ToolButton(wn) As "Toolb"
         .W = wn.W * 0.1
         .X = .W + (b * 60)
         .Y = wn.H * 0.15
         .H = wn.H * 0.8
         .Border = Border.Plain
         .Background = Color.Yellow
         .Text = CStr(b)
       End With
     Next
    
   End
    
   Public Sub Form_Open()
    
     ta = New TextArea(Me) As "TextA"
     w = New Watcher(wn) As "Osserva"
     
   End
    
   Public Sub Toolb_Click()
     
     ta.Text &= Last.Text
    
   End
    
   Public Sub Wndw_MouseDown()
    
    x = Mouse.X 
    y = Mouse.Y 
    
   End
    
   Public Sub Wndw_MouseMove()
    
     wn.Move(Mouse.ScreenX - x, Mouse.ScreenY - y)
    
   End
    
   Public Sub Osserva_Move()  ' Cuando se mueve el objeto gráfico "Window" con el ratón...
    
   ' ...también se mueve el Form:
     Me.Move(wn.X, wn.Y + wn.H)
     
   End