System.Drawing.Pen.GetPen()

Here are the examples of the csharp api class System.Drawing.Pen.GetPen() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

1. Example

Project: NGraphics
Source File: SystemDrawingPlatform.cs
public void DrawEllipse (Rect frame, Pen pen = null, Brush brush = null)
		{
			if (brush != null) {
				graphics.FillEllipse (brush.GetBrush (frame), Conversions.GetRectangleF (frame));
			}
			if (pen != null) {
				graphics.DrawEllipse (pen.GetPen (), Conversions.GetRectangleF (frame));
			}
		}

2. Example

Project: NGraphics
Source File: SystemDrawingPlatform.cs
public void DrawPath (IEnumerable<PathOp> ops, Pen pen = null, Brush brush = null)
		{
			usin/n ..... /n //View Source file for more details /n }

3. Example

Project: NGraphics
Source File: SystemDrawingPlatform.cs
public void DrawRectangle (Rect frame, Size corner, Pen pen = null, Brush brush = null)
		{
			if (corner.Width > 0 || corner.Height > 0) {
				using (var path = new GraphicsPath ()) {
					var xdia = corner.Width * 2;
					var ydia = corner.Height * 2;
					if(xdia > frame.Width)    xdia = frame.Width;
					if(ydia > frame.Height)   ydia = frame.Height;

					// define a corner 
					var Corner = Conversions.GetRectangleF (frame);

					path.AddArc (Corner, 180, 90);    

					// top right
					Corner.X += (float)(frame.Width - xdia);
					path.AddArc (Corner, 270, 90);    
    
					// bottom right
					Corner.Y += (float)(frame.Height - ydia);
					path.AddArc (Corner,   0, 90);    
    
					// bottom left
					Corner.X -= (float)(frame.Width - xdia);
					path.AddArc (Corner,  90, 90);

					// end path
					path.CloseFigure ();

					if (brush != null) {
						graphics.FillPath (brush.GetBrush (frame), path);
					}
					if (pen != null) {
						graphics.DrawPath (pen.GetPen (), path);
					}
				}
			}
			else {
				if (brush != null) {
					graphics.FillRectangle (brush.GetBrush (frame), Conversions.GetRectangleF (frame));
				}
				if (pen != null) {
					var r = Conversions.GetRectangleF (frame);
					graphics.DrawRectangle (pen.GetPen (), r.X, r.Y, r.Width, r.Height);
				}
			}
		}