コード例 #1
0
ファイル: RazorPainterWFCtl.cs プロジェクト: xstos/idx3dsharp
        public RazorPainterWFCtl()
        {
            InitializeComponent();

            MinimumSize = new Size(1, 1);

            SetStyle(ControlStyles.DoubleBuffer, false);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.Opaque, true);

            hDCGraphics = CreateGraphics();
            hDCRef      = new HandleRef(hDCGraphics, hDCGraphics.GetHdc());

            RP       = new RazorPainter();
            RazorBMP = new Bitmap(Width, Height, PixelFormat.Format32bppArgb);
            RazorGFX = Graphics.FromImage(RazorBMP);

            Resize += (sender, args) =>
            {
                lock (RazorLock)
                {
                    if (RazorGFX != null)
                    {
                        RazorGFX.Dispose();
                    }
                    if (RazorBMP != null)
                    {
                        RazorBMP.Dispose();
                    }
                    RazorBMP = new Bitmap(Width, Height, PixelFormat.Format32bppArgb);
                    RazorGFX = Graphics.FromImage(RazorBMP);
                }
            };
        }
コード例 #2
0
        public RazorPainterWPFCtl()
        {
            InitializeComponent();

            hDCGraphics = RazorBackend1.CreateGraphics();
            hDCRef      = new HandleRef(hDCGraphics, hDCGraphics.GetHdc());
            RP          = new RazorPainter();

            RazorBMP = new System.Drawing.Bitmap(RazorWidth, RazorHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            RazorGFX = System.Drawing.Graphics.FromImage(RazorBMP);

            RazorBackend1.Resize += (sender, args) =>
            {
                lock (RazorLock)
                {
                    if (RazorGFX != null)
                    {
                        RazorGFX.Dispose();
                    }
                    if (RazorBMP != null)
                    {
                        RazorBMP.Dispose();
                    }
                    RazorBMP = new System.Drawing.Bitmap(RazorWidth, RazorWidth, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
                    RazorGFX = System.Drawing.Graphics.FromImage(RazorBMP);
                }
            };
        }
コード例 #3
0
        public PainterControl()
        {
            InitializeComponent();


            this.MinimumSize = new Size(1, 1);

            SetStyle(ControlStyles.DoubleBuffer, false);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
//			SetStyle(ControlStyles.Opaque, true);

            hDCGraphics = CreateGraphics();
            hDCRef      = new HandleRef(hDCGraphics, hDCGraphics.GetHdc());

            RP = new RazorPainter();
            this.SizeChanged += ResizeProc;
            ResizeProc(null, null);
        }