Let me make this concrete. The following code snippet will draw a red
300x400 rectangle at position (100,200) on 'form' :
__gc class HandlerClass
{
public:
static void m_Paint_Event_Handler( Object*, PaintEventArgs* e )
{
Pen* pen = new Pen( Color::Red, 1 ) ;
e->Graphics->DrawRectangle( pen, 100, 200, 300, 400 ) ;
}
} ;
Form* form = new Form( ) ;
form->Paint += new PaintEventHandler( 0, HandlerClass::Paint_Event_Handler )
;
How would you modify this code so that it draws the red triangle on an
off-screen 'memory-device context' and then swaps (or copies) this
off-screen buffer to the on-screen form?
Thanks in advance! : )
[==P==]
"Peter Oliphant" <po*******@RoundTripInc.com> wrote in message
news:O%****************@TK2MSFTNGP12.phx.gbl...
The flicker is because you background is painted first to clear the
background and then your graphics shapes.
Flicker could be avoided by using a memory device context. where you draw
the complete image in a memory buffer and then swap it to the dialogbox
window, without painting the background first.
Sounds like page flipping. I like page flipping!
Ok. I currently draw to a Form (actually, my own class derived from a
Form,
but therefore it is a Form) via a Graphics object I get from the Form's
Paint event (i.e., using DrawRectange, DrawEllipse, etc.). How do I easily
create and draw to an off-screen 'memory device context'
instead of the Form, and how do I then do the swap of the results to the
Form as you mentioned?
It sounds like a great idea, but I need details! : )
[==P==]