ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   moving on userform (https://www.excelbanter.com/excel-discussion-misc-queries/101585-moving-userform.html)

Zygan

moving on userform
 

how do i create an image that i can move on a userform e,g if i was
playing chess ?


--
Zygan
------------------------------------------------------------------------
Zygan's Profile: http://www.excelforum.com/member.php...o&userid=34423
View this thread: http://www.excelforum.com/showthread...hreadid=565461


Harald Staff

moving on userform
 
Hi Zygan

userform code:

Option Explicit

Dim X1 As Long, Y1 As Long

Private Sub Image1_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
X1 = X
Y1 = Y
End Sub

Private Sub Image1_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 1 Then
Image1.Left = Image1.Left + X - X1
Image1.Top = Image1.Top + Y - Y1
End If
End Sub

HTH. Best wishes Harald

"Zygan" skrev i melding
...

how do i create an image that i can move on a userform e,g if i was
playing chess ?


--
Zygan
------------------------------------------------------------------------
Zygan's Profile:

http://www.excelforum.com/member.php...o&userid=34423
View this thread: http://www.excelforum.com/showthread...hreadid=565461





All times are GMT +1. The time now is 05:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com