wx.PaintEvent Class Reference

Inheritance diagram for wx.PaintEvent:

wx.Event wx.Object

List of all members.

Public Member Functions

 PaintEvent (int Id)
 PaintEvent (IntPtr wxObject)

Detailed Description

A paint event is sent when a window's contents needs to be repainted.

Please notice that in general it is impossible to change the drawing of a standard control (such as wx.Button) and so you shouldn't attempt to handle paint events for them as even if it might work on some platforms, this is inherently not portable and won't work everywhere.

To process a paint event, use this event handler macro to direct input to a member function that takes a wx.Event argument - expecting this to be of this class wx.PaintEvent.
EVT_PAINT(func) Process a wx.PaintEvent event.

Note that In a paint event handler, the application must always create a wx.PaintDC object, even if you do not use it. Otherwise, under MS Windows, refreshing for this and other windows will go wrong.

For example:

          void MyWindow
              public MyWindow(...)
                this.EVT_PAINT(new EventListener(OnPaint));
              void OnPaint(object sender, wx.PaintEvent event)
                using (wx.PaintDC dc = new wx.PaintDC(this))

You can optimize painting by retrieving the rectangles that have been damaged and only repainting these. The rectangles are in terms of the client area, and are unscrolled, so you will need to do some calculations using the current view position to obtain logical, scrolled units.

Constructor & Destructor Documentation

wx.PaintEvent.PaintEvent ( IntPtr  wxObject  ) 

wx.PaintEvent.PaintEvent ( int  Id  ) 

Manual of the wx.NET   (c) 2003-2011 the wx.NET project at   Get wx.NET at SourceForge.net. Fast, secure and Free Open Source software downloads