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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| Private Sub Panel1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Panel1.DragDrop
Dim p As New Point(e.X, e.Y)
p = Me.PointToClient(p)
p.X = p.X - Me.Panel1.Location.X - 5
p.Y = p.Y - Me.Panel1.Location.Y - 30 '(taille du menu)
button_test = New Button
button_test.Name = "btn_1"
button_test.Image = My.Resources.Icone_maison_home
Dim taille As System.Drawing.Size
taille.Width = 20
taille.Height = 20
button_test.Size = taille
button_test.Location = p
' AddHandler MouseClick, AddressOf btn_click
panel_isloaded = True
Me.Panel1.Controls.Add(button_test)
End Sub
Public Sub placer_boutons(ByVal ancrage_x As Integer, ByVal ancrage_y As Integer, ByVal coeff As Integer)
'Dim button As Button
'Dim d As New Point
d = Me.PointToClient(d)
'panel_isloaded = True
d.X = (button_test.Location.X - ancrage_x) * coeff
d.Y = (button_test.Location.Y - ancrage_y) * coeff
button_test.Location = d
'placer_boutons_isloaded = True
Me.Panel1.Controls.Add(button_test)
End Sub
Private Sub panel1_MouseWheel1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel
g.Clear(Color.White)
Dim x, y, z As Integer
Dim pointeur_souris As New Point(e.X, e.Y)
button_test_isloaded = True
z = e.Delta
x = e.X
y = e.Y
Me.X_ancrage = -x
Me.Y_ancrage = -y
If (z >= 0) Then 'evenement sur la molette zoom et dezoom
coeff_molette += 10
Else
coeff_molette -= 10
End If
'placer_boutons_isloaded = True
placer_boutons(pointeur_souris.X, pointeur_souris.Y, coeff_molette)
DESSINE_FRANCE(coeff_molette)
End Sub |
Partager