I came up with this to examine "up close" HiRes images from my Maps database. You can move the image around to see every part of it without going "out of bounds"
Printable View
I came up with this to examine "up close" HiRes images from my Maps database. You can move the image around to see every part of it without going "out of bounds"
you might want consider placing the second picture box within the first & then doing something like:It avoids the need for constant PaintPicturing.VB Code:
Private sX As Single, sY As Single Private Sub Picture2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = vbLeftButton Then sX = X sY = Y Screen.MousePointer = vbSizePointer End If End Sub Private Sub Picture2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim lLeft As Long, lTop As Long If Button = vbLeftButton Then ' Restrict Left lLeft = Picture2.Left + (X - sX) If lLeft > 0 Then lLeft = 0 If lLeft < Picture1.ScaleWidth - Picture2.Width Then lLeft = Picture1.ScaleWidth - Picture2.Width Picture2.Left = lLeft ' Restrict Top lTop = Picture2.Top + (Y - sY) If lTop > 0 Then lTop = 0 If lTop < Picture1.ScaleHeight - Picture2.Height Then lTop = Picture1.ScaleHeight - Picture2.Height Picture2.Top = lTop End If End Sub Private Sub Picture2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Screen.MousePointer = vbNormal End Sub Private Sub Form_Load() With Picture2 .Appearance = 0 .BorderStyle = 0 .AutoRedraw = True .AutoSize = True .Picture = LoadPicture(App.Path & "\map.jpg") .Move (Picture1.ScaleWidth - .Width) \ 2, (Picture1.ScaleHeight - .Height) \ 2 End With End Sub
You'll probably want to get a mod to move this to the CodeBank.
I tried your code bushmobile and I'm getting some weird "multiple image" effects while moving the image. Are there any property changes I should make to the controls?
I made a PictureView control two years ago. I got bored of people asking for picture scrolling so I made this control :)
I've attached an example.
(i didn't bother including the picture in the attachment)
I'll move this to the codebank, but could you pick a better title of the thread? :)
Yes it works quite nicely bushmobile... :)