Hi,
Why you load the image in the paint event?
You just load it once and that's all, after that all you would have to do
is reposition your picturebox.
below you will find a piece of code I just did for testing,
When I click on the button I load an image, the picturebox has SizeMode set
to autosize
the picturebox is inside the panel
//
// panel1
//
this.panel1.Con trols.Add(this. pictureBox1);
This is what I do when the button is pressed, you have to change it to
refrect your need
private void button1_Click(o bject sender, System.EventArg s e)
{
Bitmap b = new Bitmap( @"c:\imagenlogi n.jpg" );
pictureBox1.Ima ge = b;
}
I added a scrollbar next to the panel, this is the code for the handler
private void vScrollBar1_Scr oll(object sender,
System.Windows. Forms.ScrollEve ntArgs e)
{
pictureBox1.Top = -e.NewValue;
}
It does work as intended, if you still need help let me know and I will post
the complete code for the page
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Alberto" <al*****@nospam .com> wrote in message
news:Ov******** ******@TK2MSFTN GP09.phx.gbl...
It doesn't work. I have a pictureBox inside a panel control but when I
load a picture bigger than the PictureBox control, the bars doesn't appear.
I load the image in the paint event with this sentence:
e.graphics.Draw image(Image, 0,0);
Thank you.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us >
escribió en el mensaje news:e4******** ******@tk2msftn gp13.phx.gbl... Hi Alberto
A simpler thing would be include the ImageBox inside a panel then you
just move the ImageBox and the panel will works like a windows, which is what
you want.
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Alberto" <al*****@nospam .com> wrote in message
news:%2******** *******@tk2msft ngp13.phx.gbl.. . I'm trying to load an image in a PictureBox but I want the PictureBox has always the same size and if the image is bigger, show a scrollBars.
How can I do it?
Thank you