Alsalam alikom wa ra7mat Allah wa barakatoh
Today I've found a very nice function (actually a class) in .NET, the class is called ControlPaint, the function is called DrawReversibleFrame...
It's not a big deal but I enjoyed the idea of how this function operates.
DrawReversibleFrame(Rectangle rectangle, Color backColor, FrameStyle style);
Your first call to the function will just draw a rectangle with the color you specified.... the nice trick is that if you called this function again (with the same rectangle dimensions), it'll erase what you've just drawn (without any need to Refresh)...
As I liked it, I wanted to use it in anything, so I thought about the snapping thing...
What is it?
When you have a graphics area and the user drew some random points... if he moves the mouse near any point, a small rectangle would appear, suggesting a place (aliened with the nearest point)...
like in the following figure:Mouse near the black point.. the green rectangle is drawn using DrawReversibleFrame..
It's so easy to do that application. I just liked the idea of NoRefresh, no double buffering needed... it just manages everything.
Enjoy the rest of ControlPaint class functions...
Alsalam alikom wa ra7mat Allah wa barakatoh
Today I've found a very nice function (actually a class) in .NET, the class is called ControlPaint, the function is called DrawReversibleFrame...
It's not a big deal but I enjoyed the idea of how this function operates.
DrawReversibleFrame(Rectangle rectangle, Color backColor, FrameStyle style);
Your first call to the function will just draw a rectangle with the color you specified.... the nice trick is that if you called this function again (with the same rectangle dimensions), it'll erase what you've just drawn (without any need to Refresh)...
As I liked it, I wanted to use it in anything, so I thought about the snapping thing...
What is it?
When you have a graphics area and the user drew some random points... if he moves the mouse near any point, a small rectangle would appear, suggesting a place (aliened with the nearest point)...
like in the following figure:Mouse near the black point.. the green rectangle is drawn using DrawReversibleFrame..
It's so easy to do that application. I just liked the idea of NoRefresh, no double buffering needed... it just manages everything.
Enjoy the rest of ControlPaint class functions...
Alsalam alikom wa ra7mat Allah wa barakatoh
Comments
Post a Comment