Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent --Hscroll and VScroll for a picture box, 1

Status
Not open for further replies.

MathiKrishna

Programmer
Mar 27, 2002
13
0
0
IN
Hai ,
How can I get both scroll bars fora picture box, where the picture size is of about a A4 size paper.
Very Urgent
Regards,
Mathi
 
Try this:

1. Place a PictureBox on a form.
2. Place an Image, HScrollBar and VScrollBar control INSIDE the PictureBox.
3. Add the following code to your form:


Private Sub Form_Resize()
Picture1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
VScroll1.Height = Picture1.ScaleHeight - HScroll1.Height
VScroll1.Left = Picture1.ScaleWidth - VScroll1.Width
VScroll1.Max = Image1.Height - Picture1.ScaleHeight + HScroll1.Height
HScroll1.Width = Picture1.ScaleWidth - VScroll1.Width
HScroll1.Top = Picture1.ScaleHeight - HScroll1.Height
HScroll1.Max = Image1.Width - Picture1.ScaleWidth + VScroll1.Width
End Sub

Private Sub HScroll1_Change()
Image1.Left = -HScroll1.Value
End Sub

Private Sub VScroll1_Change()
Image1.Top = -VScroll1.Value
End Sub

Private Sub HScroll1_Scroll()
Image1.Left = -HScroll1.Value
End Sub

Private Sub VScroll1_Scroll()
Image1.Top = -VScroll1.Value
End Sub


Cheers. Be good. If you can't, don't get caught!
 
See the following thread

thread222-240239

with regards to the double frame approach, but your picture on the inner frame, and then using the same approach as the vertical scroll bar, add a horizontal scroll bar.

Good Luck
 
I just had a thought...

You could place the scroll bar on your form and then make 2 picture boxes about the same size as the Up down Arrows on the scroll bar. Place the picture boxes over top of the buttons. Then in the Click event of the picture box just point the code to the scroll or click event of the scroll bar.

lol Craig, mailto:sander@cogeco.ca

"Procrastination is the art of keeping up with yesterday."

I hope my post was helpful!!!
 
Thank you
Unscruffed's technic works well
I thank Every body who replyed my post

KEEP SMILING TODAY AND ALWAYS

Regards,
Mathi Krishna
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top