public void RunOnce(GDIRenderer aPort) { aPort.SaveState(); // Select a gray brush to draw with aPort.UseDefaultBrush(); aPort.UseDefaultPen(); aPort.SetDefaultBrushColor(RGBColor.DarkGreen); aPort.SetDefaultPenColor(RGBColor.Black); // Flip the coordinate system so 0,0 is in the lower left aPort.SetMappingMode(MappingModes.LoEnglish); //aPort.SetViewportOrigin(0, fSize.Width); aPort.ScaleTransform(1, -1); aPort.Flush(); GDIPen rectPen = new GDICosmeticPen(PenStyle.Solid, RGBColor.Red, Guid.NewGuid()); GDIBrush rectBrush = new GDISolidBrush(RGBColor.DarkCyan); for (int i = 0; i < 4; i++) { //aPort.DrawRectangle(rectPen, rects[i].Left, rects[i].Top, rects[i].Width, rects[i].Height); aPort.StrokeAndFillRectangle(rectPen, rectBrush, rects[i]); } aPort.Flush(); aPort.ResetState(); }
public void RunOnce(GDIRenderer aPort) { // Do some path stuff GPath aPath = new GPath(); aPath.Begin(); aPath.MoveTo(10, 10, false); aPath.LineTo(10, 100, false); aPath.LineTo(100, 100, true); aPath.End(); GDIBrush pathBrush = new GDIBrush(BrushStyle.Solid, HatchStyle.BDiagonal, RGBColor.Cyan, Guid.NewGuid()); aPort.FillPath(pathBrush, aPath); GDIPen pathPen = new GDIPen(PenType.Geometric, PenStyle.Solid, PenJoinStyle.Round, PenEndCap.Round, RGBColor.Black, 10, Guid.NewGuid()); //aPort.DrawPath(pathPen, aPath); // Now use a GDIPath aPort.SetBkMode((int)BackgroundMixMode.Transparent); aPort.SetTextColor(RGBColor.Black); GDIFont aFont = new GDIFont("Impact", 96, Guid.NewGuid()); GDIContext dc = aPort.DeviceContext; GDIPath gdipath = new GDIPath(dc, Guid.NewGuid()); gdipath.Begin(); aPort.SetFont(aFont); aPort.DrawString(200, 200, "The Scaled Text"); gdipath.End(); aPort.Flush(); // First fill the text aPort.FillPath(pathBrush, gdipath); // Then stroke the path around it GDIPen textPen = new GDIPen(PenType.Geometric, PenStyle.Solid, PenJoinStyle.Round, PenEndCap.Round, RGBColor.Black, 2, Guid.NewGuid()); aPort.DrawPath(textPen, gdipath); aPort.Flush(); }
public void RunOnce(GDIRenderer aPort) { aPort.SetBkMode((int)BackgroundMixMode.Transparent); aPort.SetTextColor(fTextColor); //Guid fontID = Guid.NewGuid(); //aPort.CreateFont("Times New Roman", 96, fontID); //aPort.SelectUniqueObject(fontID); aPort.SetFont(fFont); aPort.DrawString(fOrigin.X, fOrigin.Y, fStringMessage); aPort.Flush(); }
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(); }