how to refresh or keep the graphics
-
hello im using the graphics class to draw some stuff on a form. Graphics Draw = this.form1.CreateGraphics(); Draw.FillEllipse(Brushes.Red, Circles); something like that. But once the graphic is drawn and i move another form over, it disappears. so how can i keep my graphic display all the time. Thank you Donkaiser
-
hello im using the graphics class to draw some stuff on a form. Graphics Draw = this.form1.CreateGraphics(); Draw.FillEllipse(Brushes.Red, Circles); something like that. But once the graphic is drawn and i move another form over, it disappears. so how can i keep my graphic display all the time. Thank you Donkaiser
You could create an image, get the graphics context off of the image, and draw it there. Then just keep that image up on the form.
-
You could create an image, get the graphics context off of the image, and draw it there. Then just keep that image up on the form.
-
hello im using the graphics class to draw some stuff on a form. Graphics Draw = this.form1.CreateGraphics(); Draw.FillEllipse(Brushes.Red, Circles); something like that. But once the graphic is drawn and i move another form over, it disappears. so how can i keep my graphic display all the time. Thank you Donkaiser
The graphics drawn disappears because when you move the form, paint event occurs and it rpaints the form which eventually overwrites what you have written. To make the drawn graphics persistant try to override the Paint event of the form. Put your painting code in it. Hope this helps. Every bit counts ADD
-
do you have an example? I know the logic but im sure C# has some class that will take care that. and by image u mean a bitmap image or jpg image. Donkaiser
Absolutely. Take your form and add a PictureBox control to it. Then in your constructor you can do this:
this.pictureBox1.Image = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height);
Graphics g = Graphics.FromImage(this.pictureBox1.Image);
g.FillEllipse(Brushes.Red, 5, 5, 50, 50);You don't have to set anything on PictureBox, just put it on the form.