1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| Option Explicit
Private Sub Form_Load()
Label1.BorderStyle = 0: Label1.BackStyle = 0: Label1.AutoSize = True
Label1.Caption = "Démonstration d'un effet de stabilot sur un Label"
Label1.FontSize = 14: Label1.FontBold = True
Label1.Move 0, 0
Shape1.BackColor = &HC0FFC0: Shape1.BackStyle = 1: Shape1.BorderStyle = 0: Shape1.Shape = 0
Shape1.Move 0, 0, 0, Label1.Height
Shape1.ZOrder 1
Picture1.Appearance = 0: Picture1.BorderStyle = 0: Picture1.BackColor = &HFFFFFF
Picture1.Move 120, 120, Label1.Width, Label1.Height
Me.Width = ((Picture1.Left + 120) * 2) + Picture1.Width
Me.Height = Picture1.Top + Picture1.Height + Picture1.Left + 540
Me.BackColor = &H808080
End Sub
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton And Shift = vbCtrlMask Then 'Bt. droit + touche Ctrl pour surligner
Shape1.Left = X: Shape1.Width = 0
Else
Shape1.Width = 0
End If
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton And Shift = vbCtrlMask Then 'Bt. droit + touche Ctrl pour surligner
If X > Shape1.Left Then
Shape1.Width = X - Shape1.Left
Else
Dim TheWidth As Integer
TheWidth = (Shape1.Left - X) + Shape1.Width
Shape1.Left = X: Shape1.Width = TheWidth
End If
End If
End Sub |
Partager