DrawLine() public method

public DrawLine ( GDIPen aPen, Point startPOINT, Point endPoint ) : void
aPen GDIPen
startPOINT Point
endPoint Point
return void
コード例 #1
0
ファイル: LineDemo1.cs プロジェクト: Wiladams/NewTOAPIA
        public void RunOnce(GDIRenderer aPort)
        {
            int cxClient = fSize.Width;
            int cyClient = fSize.Height;

            aPort.SaveState();

            GDIPen rectPen = new GDICosmeticPen(PenStyle.Solid, RGBColor.Black, Guid.NewGuid());
            GDISolidBrush rectBrush = new GDISolidBrush(RGBColor.White);

            // Do a rectangle
            Rectangle rect = Rectangle.FromLTRB(cxClient / 8, cyClient / 8,
                (7 * cxClient / 8), (7 * cyClient / 8));
            aPort.FillRectangle(rectBrush, rect.Left, rect.Top, rect.Width, rect.Height);
            aPort.DrawRectangle(rectPen, rect.Left, rect.Top, rect.Width, rect.Height);

            // Now do a couple of lines using a dash/dot/dot pen
            GDIPen aPen = new GDIPen(PenType.Cosmetic, PenStyle.DashDotDot, PenJoinStyle.Round, PenEndCap.Round, RGBColor.Black, 1, Guid.NewGuid());
            aPort.DrawLine(aPen, new Point(0, 0), new Point(cxClient, cyClient));
            aPort.DrawLine(aPen, new Point(0, cyClient), new Point(cxClient, 0));

            // Now an ellipse
            aPort.DrawEllipse(aPen, rect);

            // Last, a rounded rectangle
            Rectangle rRect = Rectangle.FromLTRB(cxClient / 4, cyClient / 4,
                3 * cxClient / 4, 3 * cyClient / 4);
            aPort.DrawRoundRect(aPen, rRect, cxClient / 4, cyClient / 4);

            aPort.ResetState();
  
        }
コード例 #2
0
ファイル: BezierTest.cs プロジェクト: Wiladams/NewTOAPIA
        public void RunOnce(GDIRenderer aPort)
        {
            aPort.SaveState();

            // Orient the axis with origin at upper 
            // left hand corner, y-axis positive going down the screen
            aPort.SetMappingMode(MappingModes.Text);

            // Draw the curve
            aPort.DrawBeziers(fBlackPen, fFigure);

            // Draw the control lines
            // Control line 1
            aPort.DrawLine(fRedPen, new Point(fFigure[0].X, fFigure[0].Y), new Point(fFigure[1].X, fFigure[1].Y));

            // Control line 2
            aPort.DrawLine(fRedPen, new Point(fFigure[2].X, fFigure[2].Y), new Point(fFigure[3].X, fFigure[3].Y));

            aPort.Flush();
            aPort.ResetState();
        }
コード例 #3
0
ファイル: SineWave.cs プロジェクト: Wiladams/NewTOAPIA
        public void RunOnce(GDIRenderer aPort)
        {
            int i;
            int cxClient = fSize.Width;
            int cyClient = fSize.Height;
            Point[] points = new Point[fNumSegments];

            aPort.SaveState();

            GDIPen redPen = new GDIPen(RGBColor.Red);
            aPort.DrawLine(redPen, new Point(0, cyClient/2), new Point(cxClient, cyClient / 2));

            GDIPen blackPen = new GDIPen(RGBColor.Black);
            for (i = 0; i < fNumSegments; i++)
            {
                points[i].X = i * cxClient / fNumSegments;
                points[i].Y = (int)(((double)cyClient/2.0f)*(1.0f-Math.Sin(Math.PI*2.0f*(double)i/(double)fNumSegments)));
            }

            aPort.DrawLines(blackPen, points);


            aPort.ResetState();
        }