PictureBox with ScrollBars? 
Author Message
 PictureBox with ScrollBars?

Hi,

  I am able to put a bmp picture on my form using the PictureBox, but
if the picture is bigger than my form, I want to look at the picture by
moving it using the Scroll Bars. I tried so many times and it's not
working with me.
 I would appreciate if someone could show me how to use the scroll bars
with images. Thanks.



Sat, 04 Sep 1999 03:00:00 GMT  
 PictureBox with ScrollBars?

Quote:
>   I am able to put a bmp picture on my form using the PictureBox, but
> if the picture is bigger than my form, I want to look at the picture by
> moving it using the Scroll Bars. I tried so many times and it's not
> working with me.

Put two Picture Boxes on the form, one inside the other.  Put code in the
Form_Resize event to keep the outermost PictureBox' height and width equal
to that of the Form's screen.width and screen.height.  Keep the Innermost
PictureBox equal to that of image and move it around inside the outermost
PictureBox.  You can plac Scroll Bars inside the outermost PictureBox (but
outside the Innermost PictureBox) to manually move the image if you desire.

--
Marcos Miley



Sat, 04 Sep 1999 03:00:00 GMT  
 PictureBox with ScrollBars?

Quote:

> Hi,

>   I am able to put a bmp picture on my form using the PictureBox, but
> if the picture is bigger than my form, I want to look at the picture by
> moving it using the Scroll Bars. I tried so many times and it's not
> working with me.
>  I would appreciate if someone could show me how to use the scroll bars
> with images. Thanks.

Check the microsoft knowledgebase. There is an arcticle telling you
exactly how to do this.
--
Eric Zieg

************************************************************
*  It's not MY fault, it's somebody elses.                 *
*  Yeah, right ! Personal responsibility, what a concept ! *
************************************************************



Sun, 05 Sep 1999 03:00:00 GMT  
 PictureBox with ScrollBars?

Hi Marcos,

        Your reply was very helpful, but I am still having some difficulties.
When I scroll, the innermost picture moves alright but it moves beyond
it's width or height until it disapppears (which I don't want that to
happen). Also, when I get to the middle of the innermost picture, the
scroll bar should also be somewhere in the middle, which
in this case does not happen.
        I have included some of the code below.
        Thanks again...
Arthur

------------------------------------
'This is the form
Private Sub Form_Load()

Picture2.Picture = LoadPicture("Pic.BMP")
Picture2.AutoSize = True

HScroll1.Max = Picture2.Width
HScroll1.Min = 0
HScroll1.Value = 0

'To store the previous value of HScroll1.Value
OldVal = HScroll1.Value

End Sub

---------------------------------
'This is the outermost PictureBox
Private Sub Picture1_Resize()  

Picture1.Height = Form1.Height
Picture1.Width = Form1.Width

End Sub

--------------------------------
'This is the horizontal scroll bar
Private Sub HScroll1_Change()

Dim NewVal
NewVal = HScroll1.Value

'If HScroll1.Value is increased, the picture2 moves
'to left or else to the right
If OldVal < NewVal Then
Picture2.Move Picture2.Left - HScroll1.Value
Else
Picture2.Move Picture2.Left + HScroll1.Value
End If

OldVal = HScroll1.Value

End Sub

'The verrtical scroll bar will almost be the same
---------------------------------



Sun, 05 Sep 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. help: picturebox with scrollbars???

2. Help Needed for Picturebox and Scrollbars

3. PictureBox with scrollbars

4. picturebox and scrollbars ?

5. picturebox and scrollbars

6. Picturebox - scrollbars

7. Add ScrollBars to a PictureBox

8. How can I associate scrollbars to a picturebox

9. Want Scrollbars for your PictureBoxes?

10. Want Scrollbars for your PictureBoxes?

11. add scrollbars to picturebox

12. Printing ALL content in large PictureBox which has scrollbars

 

 
Powered by phpBB® Forum Software