Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 25th, 2005, 1:23 PM   #1
cloud-
Hobbyist Programmer
 
Join Date: Jan 2005
Posts: 110
Rep Power: 4 cloud- is on a distinguished road
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- is offline   Reply With Quote
Old Jan 28th, 2005, 4:22 PM   #2
cloud-
Hobbyist Programmer
 
Join Date: Jan 2005
Posts: 110
Rep Power: 4 cloud- is on a distinguished road
nevermind now

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

cloud- is offline   Reply With Quote
Old Jan 28th, 2005, 5:23 PM   #3
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
glad to hear that you got it working right.
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Feb 18th, 2005, 2:16 PM   #4
chepfaust
Programmer
 
chepfaust's Avatar
 
Join Date: Feb 2005
Posts: 62
Rep Power: 4 chepfaust is on a distinguished road
Quote:
Originally Posted by cloud-
nevermind now

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

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

Last edited by chepfaust; Feb 18th, 2005 at 2:18 PM.
chepfaust is offline   Reply With Quote
Old Feb 19th, 2005, 4:56 AM   #5
cloud-
Hobbyist Programmer
 
Join Date: Jan 2005
Posts: 110
Rep Power: 4 cloud- is on a distinguished road
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
cloud- is offline   Reply With Quote
Old Feb 19th, 2005, 1:39 PM   #6
chepfaust
Programmer
 
chepfaust's Avatar
 
Join Date: Feb 2005
Posts: 62
Rep Power: 4 chepfaust is on a distinguished road
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
chepfaust is offline   Reply With Quote
Old Feb 19th, 2005, 2:56 PM   #7
cloud-
Hobbyist Programmer
 
Join Date: Jan 2005
Posts: 110
Rep Power: 4 cloud- is on a distinguished road
np ^^
cloud- is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:39 PM.

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