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

Создание всплывающей панели (как панель задач)



'Создайте новый проект. Положите на форму компонент Timer. В свойствах
'формы укажите:
'.AutoRedraw = True
'.BorderStyle = 0
'.MinButton = False
'.MaxButton = False
'.ShowInTaskbar = False

'Вставьте следующий код:

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Private Type POINTAPI
x As Long
y As Long
End Type
Private Type Formsize
Left As Long
Top As Long
Width As Long
Height As Long
End Type

Private Const MaxSize = 50
Private Const MinSize = 1
Private Const Fade = False ' Установите данное значение либо True либо False

Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Form_Load()
Timer1.Interval = 50
Form_Resize
End Sub

Private Sub Form_Resize()
Me.Move Screen.Width - (MinSize * Screen.TwipsPerPixelX), 0, (MaxSize * Screen.TwipsPerPixelX), Screen.Height
Me.Cls
Me.Line (0, 0)-(0, Me.Height), &HFFFFFF
End Sub

Private Sub Timer1_Timer()
Dim a As POINTAPI
Dim Form As Formsize
Dim CurCut As Long

Form.Width = Me.Width / Screen.TwipsPerPixelX
Form.Left = Me.Left / Screen.TwipsPerPixelX
Form.Height = Me.Height / Screen.TwipsPerPixelY
Form.Top = Me.Top / Screen.TwipsPerPixelY
Call GetCursorPos(a)
If a.x >= Form.Left And a.x < Form.Left + Form.Width And a.y >= Form.Top And a.y < Form.Height + Form.Top Then
If Me.Tag <> "0" Then
If Fade = True Then
CurCut = 1
Do Until Me.Left - (CurCut * Screen.TwipsPerPixelX) <= Screen.Width - (MaxSize * Screen.TwipsPerPixelX)
Me.Left = Me.Left - (CurCut * Screen.TwipsPerPixelX)
DoEvents
Loop
Me.Move Screen.Width - (MaxSize * Screen.TwipsPerPixelX), 0, (MaxSize * Screen.TwipsPerPixelX), Screen.Height
Else
Me.Move Screen.Width - (MaxSize * Screen.TwipsPerPixelX), 0, (MaxSize * Screen.TwipsPerPixelX), Screen.Height
End If

Me.Tag = "0"
End If
Else
If Me.Tag <> "1" Then
If Fade = True Then
CurCut = 1
Do Until Me.Left + (CurCut * Screen.TwipsPerPixelX) >= Screen.Width - (MinSize * Screen.TwipsPerPixelX)
Me.Left = Me.Left + (CurCut * Screen.TwipsPerPixelX)
DoEvents
Loop
Me.Left = Screen.Width - (MinSize * Screen.TwipsPerPixelX)
Else
Me.Left = Screen.Width - (MinSize * Screen.TwipsPerPixelX)
End If
Me.Tag = "1"
End If
End If
End Sub


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


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

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


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