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(); }
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(IDraw2D aPort) { //aPort.SaveState(); GPen rectPen = new GPen(RGBColor.Red); GDIBrush rectBrush = new GDISolidBrush(RGBColor.Pink); for (int coord = 10; coord < fSize.Height; coord += 50) { aPort.FillRectangle(rectBrush, new Rectangle(coord, coord, 200, 200)); aPort.DrawRectangle(rectPen, new Rectangle(coord, coord, 200, 200)); } //aPort.ResetState(); }
public void RunOnce(GDIRenderer aPort) { aPort.SaveState(); GDIPen rectPen = new GDICosmeticPen(PenStyle.Solid, RGBColor.Red, Guid.NewGuid()); GDIBrush rectBrush = new GDISolidBrush(RGBColor.Pink); for (int coord = 10; coord < fSize.Height; coord += 50) { aPort.FillRectangle(rectBrush, coord, coord, 200, 200); aPort.DrawRectangle(rectPen, coord, coord, 200, 200); } aPort.ResetState(); }