Re: Scroll bars in image
From: Ignacio Machin \( .NET/ C# MVP \) ("Ignacio)
Date: 08/09/04
- Next message: Sean: "Design question for having multiple windows"
- Previous message: Jocke: "Re: ASP.NET Image Resizing"
- In reply to: Alberto: "Re: Scroll bars in image"
- Next in thread: Alberto: "Re: Scroll bars in image"
- Reply: Alberto: "Re: Scroll bars in image"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 9 Aug 2004 13:28:53 -0400
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.Controls.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(object sender, System.EventArgs e)
{
Bitmap b = new Bitmap( @"c:\imagenlogin.jpg" );
pictureBox1.Image = b;
}
I added a scrollbar next to the panel, this is the code for the handler
private void vScrollBar1_Scroll(object sender,
System.Windows.Forms.ScrollEventArgs 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" <alberto@nospam.com> wrote in message news:OvRLdXifEHA.1356@TK2MSFTNGP09.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.Drawimage(Image, 0,0); > > Thank you. > > "Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> > escribió en el mensaje news:e4fGrNifEHA.3476@tk2msftngp13.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" <alberto@nospam.com> wrote in message > > news:%23ZYhaFifEHA.556@tk2msftngp13.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 > > > > > > > > > > > >
- Next message: Sean: "Design question for having multiple windows"
- Previous message: Jocke: "Re: ASP.NET Image Resizing"
- In reply to: Alberto: "Re: Scroll bars in image"
- Next in thread: Alberto: "Re: Scroll bars in image"
- Reply: Alberto: "Re: Scroll bars in image"
- Messages sorted by: [ date ] [ thread ]