コード例 #1
0
        public void Paint(Window dest, bool fillBg)
        {
            // TestProgram.TestSomething3(this, dest, fillBg);
            // TestProgram.TestSomething4(this, dest, fillBg);
            //#if WIN32
            //        wxBufferedPaintDC   dc(dest);
            //#else
            //      ClientDC dc = new ClientDC(dest);
            //#endif

            //      dest.PrepareDC(dc);
            //      BufferedDC wdc = new BufferedDC(dc, m_pixmap);

            // Erik's (temporary) patch

            PaintDC  dc2 = new PaintDC(dest);
            MemoryDC mDC = new MemoryDC();

            wx.Bitmap bitmap = GlobalVariables.current_grid.m_pixmap;
            mDC.SelectObject(bitmap);
            dc2.DrawBitmap(bitmap, 0, 0, true);
            // mDC.DrawRectangle(10, 10, 100, 100);
            mDC.SelectObject(wx.Bitmap.NullBitmap);

            dc2.DrawBitmap(bitmap, 30, 30);

            mDC.Dispose();
            dc2.Dispose(); //needed
        }
コード例 #2
0
        public static void TestSomething()
        {
            NotebookManager top = GlobalVariables.traindir.m_frame.m_top;
            int             id  = top.FindPage("Layout");
            PaintDC         dc  = new PaintDC(top.GetPage(id));

            // dc.Font = font;
            // dc.TextForeground = textColour;
            dc.BackgroundMode = DCBackgroundMode.TRANSPARENT;

            dc.BackgroundMode = DCBackgroundMode.SOLID;
            dc.Background     = new Brush(new Colour(0x80, 0, 0));
            dc.Clear();

            dc.DrawText("wxWidgets common dialogs test application", 10, 10);

            dc.Dispose(); //needed
        }
コード例 #3
0
        public void OnPaint(object sender, Event e)
        {
            PaintDC dc = new PaintDC(this);

            dc.Font           = font;
            dc.TextForeground = textColour;
            dc.BackgroundMode = DCBackgroundMode.TRANSPARENT;

            dc.BackgroundMode = DCBackgroundMode.SOLID;
            dc.Background     = new Brush(new Colour(0x80, 0, 0));
            dc.Clear();

            dc.DrawText("wxWidgets common dialogs test application", 10, 10);

            Image img;

            // img = new Image(50, 50);
            img = GlobalFunctions.get_pixmap(GlobalVariables.itin_xpm);

            List <byte>   list    = new List <byte>();
            ASCIIEncoding encoder = new ASCIIEncoding();

            byte[] terminator = new byte[] { 0x10, 0x13 };
            list.Clear();
            list.AddRange(encoder.GetBytes("/* XPM */")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("static char * plaid[] = {")); list.AddRange(terminator);
//      list.AddRange(encoder.GetBytes("/* plaid pixmap ")); list.AddRange(terminator);
//      list.AddRange(encoder.GetBytes(" * width height ncolors chars_per_pixel */")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"22 22 5 2\",")); list.AddRange(terminator);
//      list.AddRange(encoder.GetBytes("/* colors */")); list.AddRange(terminator);
#if false
            list.AddRange(encoder.GetBytes("\".  c red       m white  s light_color \",")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"Y  c green     m black  s lines_in_mix \",")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"+  c yellow    m white  s lines_in_dark \",")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"x              m black  s dark_color \",")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"   c none               s mask \",")); list.AddRange(terminator);
#else
            list.AddRange(encoder.GetBytes("\".      c lightgray\",")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"Y      c #000000000000\",")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"+      c #000000000000\",")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"x      c #000000000000\",")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"       c #000000000000\",")); list.AddRange(terminator);
#endif
//      list.AddRange(encoder.GetBytes("/* pixels */")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"                      x x x x x + x x x x x \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"                    . x x x x x x x x x x x \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"                  . x x x x x x + x x x x x \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"                . x . x x x x x x x x x x x \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"              . x . x x x x x x + x x x x x \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"            Y Y Y Y Y + x + x + x + x + x + \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"          x x . x . x x x x x x + x x x x x \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"        . x . x . x . x x x x x x x x x x x \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"      . x x x . x . x x x x x x + x x x x x \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"    . x . x . x . x . x x x x x x x x x x x \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"  . x . x x x . x . x x x x x x + x x x x x \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\". . . . . x . . . . . x . x . x Y x . x . x \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\". . . . . x . . . . . . x . x . Y . x . x . \",")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\". . . . . x . . . . . x . x . x Y x . x . x \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\". . . . . x . . . . . . x . x . Y . x . x . \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\". . . . . x . . . . . x . x . x Y x . x . x \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\"x x x x x x x x x x x x x x x x x x x x x x \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\". . . . . x . . . . . x . x . x Y x . x . x \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\". . . . . x . . . . . . x . x . Y . x . x . \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\". . . . . x . . . . . x . x . x Y x . x . x \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\". . . . . x . . . . . . x . x . Y . x . x . \", ")); list.AddRange(terminator);
            list.AddRange(encoder.GetBytes("\". . . . . x . . . . . x . x . x Y x . x . x \"")); list.AddRange(terminator);

            byte[] data      = list.ToArray();
            string debugData = encoder.GetString(data);
            img = new Image(data, BitmapType.wxBITMAP_TYPE_XPM);

            img = ConvertFormat(GlobalVariables.itin_xpm);


            MemoryDC mDC    = new MemoryDC();
            Bitmap   bitmap = new Bitmap(img, -1);
            bitmap = GlobalVariables.current_grid.m_pixmap;
            mDC.SelectObject(bitmap);
            dc.DrawBitmap(bitmap, 0, 0, true);
            // mDC.DrawRectangle(10, 10, 100, 100);
            mDC.SelectObject(Bitmap.NullBitmap);

            dc.DrawBitmap(bitmap, 30, 30);



            mDC.Dispose();
            dc.Dispose(); //needed
        }
コード例 #4
0
        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;
        }