I'm trying to render bitmap created from drawing to screen but only render after minimize and maximize again.
I follow this steps: Using Bitmaps for Persistent Graphics in C#
But only cannot render bitmap in screen outside of Load_Form.
If I put the code:
Graphics graphicsObj;
myBitmap = new Bitmap(this.ClientRectangle.Width,
this.ClientRectangle.Height,
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
graphicsObj = Graphics.FromImage(myBitmap);
Pen myPen = new Pen(System.Drawing.Color.Plum, 3);
Rectangle rectangleObj = new Rectangle(10, 10, 200, 200);
graphicsObj.DrawEllipse(myPen, rectangleObj);
graphicsObj.Dispose();
in other place, for example a button I need minimize and mazimize to see the image.
Thanks in Avanced!
Aucun commentaire:
Enregistrer un commentaire