Главная страницаОбратная связьКарта сайта

Как сделать dockable toolbar, чтобы можно было прикрепить к любой стороне формы



Private Sub mnuToolbarShow_Click()
mnuToolbarShow.Checked = Not mnuToolbarShow.Checked
Toolbar1.Visible = mnuToolbarShow.Checked
End Sub

' See which edge Is closest To the mouse.
Private Sub Toolbar1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim dist_to_top As Single
Dim dist_to_left As Single
Dim dist_to_right As Single
Dim dist_to_bottom As Single
Dim smallest As Single

' See which Is closest.
dist_to_top = Toolbar1.Top + y
dist_to_left = Toolbar1.Left + x
dist_to_right = Toolbar1.Left + ScaleWidth - x
dist_to_bottom = Toolbar1.Top + ScaleHeight - y
smallest = dist_to_top
If smallest > dist_to_left Then smallest = dist_to_left
If smallest > dist_to_right Then smallest = dist_to_right
If smallest > dist_to_bottom Then smallest = dist_to_bottom

' Move the toolbar.
If dist_to_left = smallest Then
Toolbar1.Align = vbAlignLeft
ElseIf dist_to_top = smallest Then
Toolbar1.Align = vbAlignTop
ElseIf dist_to_right = smallest Then
Toolbar1.Align = vbAlignRight
Else
Toolbar1.Align = vbAlignBottom
End If
End Sub


Обсудить статью на форуме


Если Вас заинтересовала или понравилась информация программирование на Visual Basic - "Как сделать dockable toolbar, чтобы можно было прикрепить к любой стороне формы", Вы можете поставить закладку в социальной сети или в своём блоге на данную страницу:

Так же Вы можете задать вопрос по работе этого модуля или примера через форму обратной связи, в сообщение обязательно указывайте название или ссылку на статью!
   


Copyright © 2008 - 2024 Дискета.info