public static void TestSomething3(grid g, Window dest, bool fillBg) { if (!debug) { return; } TestSomething2(); ClientDC dc = new ClientDC(dest); dest.PrepareDC(dc); BufferedDC wdc = new BufferedDC(dc, g.m_pixmap); }
public static void TestSomething2() { #if true ClientDC dc = new ClientDC(GlobalVariables.field_grid.m_parent); Pen pen = new Pen(new Colour(0xF0, 0x00, 0x00), 1); // red pen of width 1 dc.Background = new Brush(new Colour(0x00, 0x00, 0xFF)); dc.BackgroundMode = DCBackgroundMode.SOLID; dc.Clear(); dc.SetPen(pen); dc.DrawPoint(10, 10); dc.DrawRectangle(2, 2, 100, 100); // dc.SetPen(wx.Pen.null); dc.Dispose(); return; #endif grid g; g = GlobalVariables.field_grid; #if true g.m_parent.BackgroundStyle = BackgroundStyle.wxBG_STYLE_COLOUR; g.m_parent.BackgroundColour = new Colour(0x00, 0x80, 0x00); #endif #if true g.m_pixmap = new Bitmap(500, 500); MemoryDC mDC = new MemoryDC(); Bitmap bitmap = g.m_pixmap; mDC.SelectObject(bitmap); // dc.DrawBitmap(bitmap, 0, 0, true); mDC.SetBrush(new Brush(new Colour(0xFF, 0x00, 0x00))); mDC.DrawRectangle(10, 10, 100, 100); mDC.SelectObject(Bitmap.NullBitmap); // dc.DrawBitmap(bitmap, 30, 30); mDC.Dispose(); #endif ClientDC clientDC = new ClientDC(g.m_parent); ScrolledWindow w = (ScrolledWindow)g.m_parent; w.PrepareDC(clientDC); BufferedDC wdc = new BufferedDC(clientDC, g.m_pixmap); #if true wdc.DrawBitmap(bitmap, 10, 10); wdc.Dispose(); wdc = null; #endif }
public static void TestSomething4(grid grid, Window dest, bool fillBg) { PaintDC dc2 = new PaintDC(dest); dc2.BackgroundMode = DCBackgroundMode.SOLID; dc2.Background = new Brush(new Colour(0x80, 0, 0)); dc2.Clear(); #if false MemoryDC mDC = new MemoryDC(); Bitmap bitmap = null; // new Bitmap(img, -1); bitmap = GlobalVariables.current_grid.m_pixmap; mDC.SelectObject(bitmap); dc2.DrawBitmap(bitmap, 0, 0, true); // mDC.DrawRectangle(10, 10, 100, 100); mDC.SelectObject(Bitmap.NullBitmap); dc2.DrawBitmap(bitmap, 30, 30); mDC.Dispose(); dc2.Dispose(); //needed #else if ((DateTime.Now - mLastTime).TotalMilliseconds < 500) { return; } try { #if WIN32 wxBufferedPaintDC dc(dest); #else ClientDC dc = new ClientDC(dest); #endif dest.PrepareDC(dc); BufferedDC wdc = new BufferedDC(dc, grid.m_pixmap); } catch (Exception) { } #endif return; if ((DateTime.Now - mLastTime).TotalMilliseconds < 500) { return; } try { #if WIN32 wxBufferedPaintDC dc(dest); #else ClientDC dc = new ClientDC(dest); #endif dest.PrepareDC(dc); BufferedDC wdc = new BufferedDC(dc, grid.m_pixmap); } catch (Exception) { } mLastTime = DateTime.Now; }