B
Barry
Hi
why does the following code not display the image
public Form1()
{
InitializeComponent();
Bitmap imgBg = new Bitmap("Monitor.bmp");
Graphics gr = Graphics.FromImage(imgBg);
gr.DrawImage(imgBg, new Rectangle(10,10, imgBg.Width, imgBg.Height));
}
if i shift the above code in the paint event like this it displays the
bitmap
private void Form1_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
Bitmap imgBg = new Bitmap("Monitor.bmp");
e.Graphics.DrawImage(imgBg, new Rectangle(10,10, imgBg.Width,
imgBg.Height));
}
Barry
why does the following code not display the image
public Form1()
{
InitializeComponent();
Bitmap imgBg = new Bitmap("Monitor.bmp");
Graphics gr = Graphics.FromImage(imgBg);
gr.DrawImage(imgBg, new Rectangle(10,10, imgBg.Width, imgBg.Height));
}
if i shift the above code in the paint event like this it displays the
bitmap
private void Form1_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
Bitmap imgBg = new Bitmap("Monitor.bmp");
e.Graphics.DrawImage(imgBg, new Rectangle(10,10, imgBg.Width,
imgBg.Height));
}
Barry