Hi, i was wondering how i can put images and move them around and where ever i put them when i close the program that it saves it. Please tell me how i can do this thanks for your help
andrew
Printable View
Hi, i was wondering how i can put images and move them around and where ever i put them when i close the program that it saves it. Please tell me how i can do this thanks for your help
andrew
Code:Option Explicit
Private mPicX As Single
Private mPicY As Single
Private Sub Form_Load()
Picture1.Left = CSng(GetSetting(App.EXEName, "Picture1 Position", "X", Picture1.Left))
Picture1.Top = CSng(GetSetting(App.EXEName, "Picture1 Position", "Y", Picture1.Top))
End Sub
Private Sub Form_Unload(Cancel As Integer)
SaveSetting App.EXEName, "Picture1 Position", "X", CStr(Picture1.Left)
SaveSetting App.EXEName, "Picture1 Position", "Y", CStr(Picture1.Top)
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
mPicX = X
mPicY = Y
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Picture1.Left = Picture1.Left - (mPicX - X)
Picture1.Top = Picture1.Top - (mPicY - Y)
End If
End Sub
Controls have a .Move method which can be used to resize & move them. Here is one solution from this site; you may want to search a bit more.
To save the settings and read them back, a common approach is to use an INI file. Here is an example from this site
Thanks so much for your help.
Now that we've helped you, you can help us by pulling down the Thread Tools menu and selecting the Mark Thread Resolved item which will let everyone know that you have your answer. Also if someone has been particularly helpful you have the ability to affect a their forum "reputation" by rating their post. (No need to do it for me.) Only those ratings that you give after you have 20 posts will actually count, but in all cases the person you rate will see it and know that you appreciate their help.