Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic (http://www.programmingforums.org/forum18.html)
-   -   picturebox scroll bars ;) (http://www.programmingforums.org/showthread.php?t=1976)

cloud- Jan 25th, 2005 12:23 PM

picturebox scroll bars ;)
 
well i added an image to my dialog (inside a picturebox)
and added scroll bars (H and V)
and when i have a picture and scroll the bar
it doest scroll through the whole picture.

code:
:

Private Sub Command12_Click()
  CommonDialog1.DialogTitle = "Load Picture"
  CommonDialog1.InitDir = App.Path & "\Images"
  CommonDialog1.Filter = "Bitmaps (*.bmp)|*.bmp|Jpegs (*.jpg)|*.jpg|Gifs (*.gif)|*.gif"
  CommonDialog1.ShowOpen
  Image1.Picture = LoadPicture(CommonDialog1.FileName)
  HScroll1.Max = Picture7.ScaleWidth
  VScroll1.Max = Picture7.ScaleHeight
End Sub

Private Sub VScroll1_Change()
  Call Image1.Move(Image1.Left, -(VScroll1.Value))
End Sub

Private Sub HScroll1_Change()
 Call Image1.Move(Image1.Top, -HScroll1.Value)
End Sub


also if the image is smaller than the picture box id like
it to be centered in the picture box
and the scroll bars to be disabled


please help me out here

thanks alot :)

cloud- Jan 28th, 2005 3:22 PM

nevermind now

i managed to find a cool control that does the auto scrolling (and works great)

:P

Pizentios Jan 28th, 2005 4:23 PM

glad to hear that you got it working right.

chepfaust Feb 18th, 2005 1:16 PM

Quote:

Originally Posted by cloud-
nevermind now

i managed to find a cool control that does the auto scrolling (and works great)

:P

hello,

i'm ressurrecting this topic because i am trying to do the same thing. i've got an image that displays in a picturebox according to whatever the user selects in a dirlistbox, but most of the images that get selected and displayed are 3-4x as large as the picturebox. based on my research, microsoft hasn't implemented any useful image controls in even the newest versions of VB. i'm using VB6 by the way.

is there any way to allow the user to "grab" and pan the image within the box like you can "grab" and pan a .pdf document? or at least is there some relatively easy way of installing scrollbars to do the same? i tried modifying this guy's (broken?) code but couldn't get it to work.

thanks

cloud- Feb 19th, 2005 3:56 AM

hey ^^
heres a link to the ocx
http://vegetasan.websiteallies.com/%.../ASPicture.zip

im not sure about the image grabbing but the scroll bars work really well
maybe you can use the mouse move event and check if the mouse button is
pressed down. then use the windows properties to move it.

good luck :)

chepfaust Feb 19th, 2005 12:39 PM

Quote:

Originally Posted by cloud-
hey ^^
heres a link to the ocx
http://vegetasan.websiteallies.com/%.../ASPicture.zip

im not sure about the image grabbing but the scroll bars work really well
maybe you can use the mouse move event and check if the mouse button is
pressed down. then use the windows properties to move it.

good luck :)

cool. thanks for both the link and the pointer :)

cloud- Feb 19th, 2005 1:56 PM

np ^^


All times are GMT -5. The time now is 7:41 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC