wx.MemoryDC Class Reference

Inheritance diagram for wx.MemoryDC:

wx.WindowDC wx.DC wx.Object wx.BufferedDC wx.BufferedPaintDC

List of all members.

Public Member Functions

 MemoryDC (DC dc)
 MemoryDC ()
 MemoryDC (IntPtr wxObject)
void SelectObject (Bitmap bitmap)

Detailed Description

A memory device context provides a means to draw graphics onto a bitmap. When drawing in to a mono-bitmap, using wxWHITE, wxWHITE_PEN and wxWHITE_BRUSH will draw the background colour (i.e. 0) whereas all other colours will draw the foreground colour (i.e. 1).

A bitmap must be selected into the new memory DC before it may be used for anything. Typical usage is as follows:

        wx.MemoryDC temp_dc;
        // We can now draw into the memory DC...
        // Copy from this DC to another DC.
        old_dc.Blit(250, 50, BITMAP_WIDTH, BITMAP_HEIGHT, temp_dc, 0, 0);
Note that the memory DC must be deleted (or the bitmap selected out of it) before a bitmap can be reselected into another memory DC.

Constructor & Destructor Documentation

wx.MemoryDC.MemoryDC ( IntPtr  wxObject  ) 

wx.MemoryDC.MemoryDC (  ) 

wx.MemoryDC.MemoryDC ( DC  dc  ) 

Member Function Documentation

void wx.MemoryDC.SelectObject ( Bitmap  bitmap  ) 

Selects the given bitmap into the device context, to use as the memory bitmap. Selecting the bitmap into a memory DC allows you to draw into the DC (and therefore the bitmap) and also to use wx.DC.Blit to copy the bitmap to a window. For this purpose, you may find wx.DC.DrawIcon easier to use instead.

If the argument is wx.NullBitmap (or some other uninitialised wx.Bitmap) the current bitmap is selected out of the device context, and the original bitmap restored, allowing the current bitmap to be destroyed safely.

Be careful to use this function and not SelectObjectAsSource when you want to modify the bitmap you are selecting otherwise you may incurr in some problems related to wx.Bitmap being a reference counted object (see reference counting overview).


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