A
Alberto
I'm trying to load an image and show it on a panel control. The code is
this:
private void btnCargarImagen_Click(object sender, System.EventArgs e)
{
openFileDialog1.InitialDirectory = Directory.GetCurrentDirectory();
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
Image = Image.FromFile(openFileDialog1.FileName);
panelImage.AutoScrollMinSize = Image.Size;
panelImage.Invalidate();
}
}
private void panelImage_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
if (Image != null)
e.Graphics.DrawImage(Image, this.AutoScrollPosition);
}
}
The Image is loaded but when I move the panel's bar, I don't see the image
properly.
Does anybody know what's happening?
Thank you very much
this:
private void btnCargarImagen_Click(object sender, System.EventArgs e)
{
openFileDialog1.InitialDirectory = Directory.GetCurrentDirectory();
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
Image = Image.FromFile(openFileDialog1.FileName);
panelImage.AutoScrollMinSize = Image.Size;
panelImage.Invalidate();
}
}
private void panelImage_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
if (Image != null)
e.Graphics.DrawImage(Image, this.AutoScrollPosition);
}
}
The Image is loaded but when I move the panel's bar, I don't see the image
properly.
Does anybody know what's happening?
Thank you very much