By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,166 Members | 1,575 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,166 IT Pros & Developers. It's quick & easy.

Panels and Graphics

P: n/a
I have a panel which uses DrawImage to paint an image that is actually
larger than the frame of the panel. But I have two problems:

1. Is there nay way to add scroll bars so that it includes the whole
image at present the only way to do this is for me to add a control in
the panel at a position out of the frames size range - the
autoscrollbars then kick in and allow me to scroll around the image.

2. When I do the above, the image is "erased" as it gets moved from the
screen. for example if I scroll down 10 pixels and then back up, the 10
pixels that used to have the image have vanished. the image seems to
only exist in the protion of the panel that was initialy visible when
the drawimage command was done.

Is there any way to have the whole image placed in the panel and then to
have scroll bars that alow me to scroll around the image?

Thanks for any help you guys can offer in advance...

Niels
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,
Try something like this.

Dim bm As Bitmap

bm = Bitmap.FromFile("MyImage.bmp")

Panel1.AutoScroll = True

Panel1.AutoScrollMinSize = bm.Size

Panel1.BackgroundImage = bm

Ken

----------------------

"Niels Jensen" <ni***@surf-spot.co.uk> wrote in message
news:LO********************@pipex.net...
I have a panel which uses DrawImage to paint an image that is actually
larger than the frame of the panel. But I have two problems:

1. Is there nay way to add scroll bars so that it includes the whole
image at present the only way to do this is for me to add a control in
the panel at a position out of the frames size range - the
autoscrollbars then kick in and allow me to scroll around the image.

2. When I do the above, the image is "erased" as it gets moved from the
screen. for example if I scroll down 10 pixels and then back up, the 10
pixels that used to have the image have vanished. the image seems to
only exist in the protion of the panel that was initialy visible when
the drawimage command was done.

Is there any way to have the whole image placed in the panel and then to
have scroll bars that alow me to scroll around the image?

Thanks for any help you guys can offer in advance...

Niels
Nov 21 '05 #2

P: n/a
Hi Ken,

Thanks Ken - the scrollbars and backgroundimage work a treat however, now I
have the problem that whenever I move the scrollbars the backgroundimage
seems to be redrawn at every pixel it moves making a big mess on the panel.

I thought it's because it's repainting every time the scrollbars move so I
tried moving the statement to the onload section of the form, but this does
the same thing and messes up my picture.

What am I doing wrong?

Niels

"Ken Tucker [MVP]" wrote:
Hi,
Try something like this.

Dim bm As Bitmap

bm = Bitmap.FromFile("MyImage.bmp")

Panel1.AutoScroll = True

Panel1.AutoScrollMinSize = bm.Size

Panel1.BackgroundImage = bm

Ken

----------------------

"Niels Jensen" <ni***@surf-spot.co.uk> wrote in message
news:LO********************@pipex.net...
I have a panel which uses DrawImage to paint an image that is actually
larger than the frame of the panel. But I have two problems:

1. Is there nay way to add scroll bars so that it includes the whole
image at present the only way to do this is for me to add a control in
the panel at a position out of the frames size range - the
autoscrollbars then kick in and allow me to scroll around the image.

2. When I do the above, the image is "erased" as it gets moved from the
screen. for example if I scroll down 10 pixels and then back up, the 10
pixels that used to have the image have vanished. the image seems to
only exist in the protion of the panel that was initialy visible when
the drawimage command was done.

Is there any way to have the whole image placed in the panel and then to
have scroll bars that alow me to scroll around the image?

Thanks for any help you guys can offer in advance...

Niels

Nov 21 '05 #3

P: n/a
Hi,

I usually place a picturebox in the panel and set the autoscroll
property to true on the panel. I make the pictureboxes size mode to
autosize. If the picture is bigger than the panel the scroll bars will
appear.
Ken
----------------------------
"Niels Jensen" <Ni*********@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.com...
Hi Ken,

Thanks Ken - the scrollbars and backgroundimage work a treat however, now I
have the problem that whenever I move the scrollbars the backgroundimage
seems to be redrawn at every pixel it moves making a big mess on the panel.

I thought it's because it's repainting every time the scrollbars move so I
tried moving the statement to the onload section of the form, but this does
the same thing and messes up my picture.

What am I doing wrong?

Niels

"Ken Tucker [MVP]" wrote:
Hi,
Try something like this.

Dim bm As Bitmap

bm = Bitmap.FromFile("MyImage.bmp")

Panel1.AutoScroll = True

Panel1.AutoScrollMinSize = bm.Size

Panel1.BackgroundImage = bm

Ken

----------------------

"Niels Jensen" <ni***@surf-spot.co.uk> wrote in message
news:LO********************@pipex.net...
I have a panel which uses DrawImage to paint an image that is actually
larger than the frame of the panel. But I have two problems:

1. Is there nay way to add scroll bars so that it includes the whole
image at present the only way to do this is for me to add a control in
the panel at a position out of the frames size range - the
autoscrollbars then kick in and allow me to scroll around the image.

2. When I do the above, the image is "erased" as it gets moved from the
screen. for example if I scroll down 10 pixels and then back up, the 10
pixels that used to have the image have vanished. the image seems to
only exist in the protion of the panel that was initialy visible when
the drawimage command was done.

Is there any way to have the whole image placed in the panel and then to
have scroll bars that alow me to scroll around the image?

Thanks for any help you guys can offer in advance...

Niels

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.