コード例 #1
0
        private void Draw(Gdi::Graphics g)
        {
            if (this.bmp != null)
            {
                //g.DrawLine(Gdi::Pens.Blue,0,0,100,100);

                /*
                 * g.DrawImageUnscaledAndClipped(
                 *      bmp,
                 *      new Gdi::Rectangle(0,0,this.Width,this.Height)
                 *      );
                 * //*/
                g.Clear(this.BackColor);
                g.DrawImage(this.bmp, rcDest, rcSrc, Gdi::GraphicsUnit.Pixel);
            }
        }
コード例 #2
0
        protected override void WndProc(ref System.Windows.Forms.Message m)
        {
            base.WndProc(ref m);
            if (m.Result == (System.IntPtr) 0)
            {
                return;
            }

            if (m.Msg == (int)mwg.Win32.WM.PAINT)
            {
                Gdi::Graphics g = this.CreateGraphics();
                g.Clear(Gdi::Color.Red);
                g.Dispose();

                m.Result = (System.IntPtr) 0;
            }
        }
コード例 #3
0
ファイル: Form2.cs プロジェクト: akinomyoga/hnk
 void UpdatePictureImage()
 {
     if (this.targetImage != null && this.backImage != null)
     {
         using (Gdi::Graphics g = Gdi::Graphics.FromImage(this.backImage)){
             double sx = (double)this.targetImage.Width / this.backImage.Width;
             double sy = (double)this.targetImage.Height / this.backImage.Height;
             double s  = System.Math.Max(sx, sy) * 1.2;
             float  x  = (float)System.Math.Round(0.5 * (this.backImage.Width - this.targetImage.Width / s));
             float  y  = (float)System.Math.Round(0.5 * (this.backImage.Height - this.targetImage.Height / s));
             float  w  = (float)System.Math.Round(this.targetImage.Width / s);
             float  h  = (float)System.Math.Round(this.targetImage.Height / s);
             g.Clear(Gdi::Color.Transparent);
             g.DrawImage(this.targetImage, x, y, w, h);
             this.deform.SetRectangle(x, y, w, h);
             this.deform.imageWidth  = this.targetImage.Width;
             this.deform.imageHeight = this.targetImage.Height;
             this.deform.Draw(this.foreGraphics);
         }
     }
 }
コード例 #4
0
ファイル: Form2.cs プロジェクト: akinomyoga/hnk
 public void Draw(Gdi::Graphics g)
 {
     g.Clear(Gdi::Color.Transparent);
     g.DrawLine(Gdi::Pens.Blue, this.p1.ToPointF(), this.q1.ToPointF());
     g.DrawLine(Gdi::Pens.Blue, this.p2.ToPointF(), this.q1.ToPointF());
     g.DrawLine(Gdi::Pens.Blue, this.p2.ToPointF(), this.q2.ToPointF());
     g.DrawLine(Gdi::Pens.Blue, this.p3.ToPointF(), this.q2.ToPointF());
     g.DrawLine(Gdi::Pens.Blue, this.p3.ToPointF(), this.q3.ToPointF());
     g.DrawLine(Gdi::Pens.Blue, this.p4.ToPointF(), this.q3.ToPointF());
     g.DrawLine(Gdi::Pens.Blue, this.p4.ToPointF(), this.q4.ToPointF());
     g.DrawLine(Gdi::Pens.Blue, this.p1.ToPointF(), this.q4.ToPointF());
     DrawBezier(g, this.p1, this.q1, this.p2);
     DrawBezier(g, this.p2, this.q2, this.p3);
     DrawBezier(g, this.p3, this.q3, this.p4);
     DrawBezier(g, this.p4, this.q4, this.p1);
     DrawControlPoint(g, this.p1);
     DrawControlPoint(g, this.p2);
     DrawControlPoint(g, this.p3);
     DrawControlPoint(g, this.p4);
     DrawControlPoint(g, this.q1);
     DrawControlPoint(g, this.q2);
     DrawControlPoint(g, this.q3);
     DrawControlPoint(g, this.q4);
 }