S
Saso Zagoranski
Hi!
I have three transparent panels on my form. The three panels represent three
layers.
I would like to draw to those panels but since Panel doesn't support
CreateGraphics()
I create a Bitmap:
bitmap = new Bitmap(sizeX,sizeY);
Get the Graphics object of that bitmap:
Graphics g = Graphics.FromImage(bitmap);
Then I draw to g and in the end I call the panel.Invalidate() method:
private void layerOne_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawImage(bitmap,0,0);
}
layerOne is the first panel. The problem is that when I call the
layerOne.Invalidate() method
the Paint event handler isn't even called?
How can I fix this problem?
One other thing... Is there a better way of creating layers of graphics
object? I would like to
have a map on the base layer and than some small circles on the second layer
and some other stuff
(not yet sure what) on the third one.
Is using panels the right way of doing this?
thanks,
saso
I have three transparent panels on my form. The three panels represent three
layers.
I would like to draw to those panels but since Panel doesn't support
CreateGraphics()
I create a Bitmap:
bitmap = new Bitmap(sizeX,sizeY);
Get the Graphics object of that bitmap:
Graphics g = Graphics.FromImage(bitmap);
Then I draw to g and in the end I call the panel.Invalidate() method:
private void layerOne_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawImage(bitmap,0,0);
}
layerOne is the first panel. The problem is that when I call the
layerOne.Invalidate() method
the Paint event handler isn't even called?
How can I fix this problem?
One other thing... Is there a better way of creating layers of graphics
object? I would like to
have a map on the base layer and than some small circles on the second layer
and some other stuff
(not yet sure what) on the third one.
Is using panels the right way of doing this?
thanks,
saso