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

Da Gambas-it.org - Wikipedia.

Mostriamo un possibile codice, per simulare il posizionamento di alcuni ToolButton (o di altri Controlli grafici) sulla barra del titolo di un Form:

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()  ' Quando viene spostato il Controllo "Window" con il mouse...

' ...si sposta anche il "Form:"
 Me.Move(wn.X, wn.Y + wn.H)

End