i 'm new in C# but i have an old hope to make a program using shapes and figures and moving them with mouse.
my problem is : is there a way to restor previous image or background after moving the figure, like a CAD software does !!
Thanks X 10000.
i 'm new in C# but i have an old hope to make a program using shapes and figures and moving them with mouse.
my problem is : is there a way to restor previous image or background after moving the figure, like a CAD software does !!
Thanks X 10000.
Moving a shape with mouse
Lukasz Pietrzak
Very Helpful...
Thanks 30000
praveen gupta
WebMetro
Howdy,
This depends on the scenario you are in, but everything is possible.
You need to override the OnPaintBackground method of your form or control and set comment out the base update statement. You should be overriding the OnPaint method at any rate, and its in here that you should be calling the Clear method from your graphics context. So an example might look like the following:
protected override void OnPaintBackground(PaintEventArgs pevent)
{
//Don't allow the background to paint
}
protected override void OnPaint(PaintEventArgs e){
//Setup the new back buffers where _screenBackBufer is a Bitmap if (this._screenBackBuffer == null) this._screenBackBuffer = new Bitmap(this.ClientSize.Width, this.ClientSize.Height); //New empty buffers wher _screenGraphics is a graphic object this._screenGraphics = Graphics.FromImage(this._screenBackBuffer);
//Set the background color of our form this._screenGraphics.Clear(this._formBackColor); this._screenGraphics.SmoothingMode = SmoothingMode.AntiAlias; //Are we in design time mode if (this.DesignMode){
//Clean up this._screenGraphics.Dispose(); //Copy the back buffer to the screen e.Graphics.DrawImageUnscaled(this._screenBackBuffer, 0, 0); return;}
try{
//Draw everything now in this method this.DrawObjects(); //Clean up this._screenGraphics.Dispose(); //Copy the back buffer to the screen e.Graphics.DrawImageUnscaled(this._screenBackBuffer, 0, 0);}
catch{
//just incase this.Invalidate();}
}
Good luck with it..
Nilushan
it's an idea, as i'm new i'll try , the execution time is important i'll analyse.
thanks X 20000