public WindowsPen(DeviceContext dc, WindowsPenStyle style, int width, WindowsBrush windowsBrush)
 {
     this.style = style;
     this.wndBrush = (WindowsBrush) windowsBrush.Clone();
     this.width = width;
     this.color = windowsBrush.Color;
     this.dc = dc;
 }
 private static void DrawAndFillEllipse(WindowsGraphics wg, WindowsPen borderPen, WindowsBrush fieldBrush, Rectangle bounds)
 {
     if (wg != null)
     {
         wg.FillRectangle(fieldBrush, new Rectangle(bounds.X + 2, bounds.Y + 2, 8, 8));
         wg.FillRectangle(fieldBrush, new Rectangle(bounds.X + 4, bounds.Y + 1, 4, 10));
         wg.FillRectangle(fieldBrush, new Rectangle(bounds.X + 1, bounds.Y + 4, 10, 4));
         wg.DrawLine(borderPen, new Point(bounds.X + 4, bounds.Y), new Point(bounds.X + 8, bounds.Y));
         wg.DrawLine(borderPen, new Point(bounds.X + 4, bounds.Y + 11), new Point(bounds.X + 8, bounds.Y + 11));
         wg.DrawLine(borderPen, new Point(bounds.X + 2, bounds.Y + 1), new Point(bounds.X + 4, bounds.Y + 1));
         wg.DrawLine(borderPen, new Point(bounds.X + 8, bounds.Y + 1), new Point(bounds.X + 10, bounds.Y + 1));
         wg.DrawLine(borderPen, new Point(bounds.X + 2, bounds.Y + 10), new Point(bounds.X + 4, bounds.Y + 10));
         wg.DrawLine(borderPen, new Point(bounds.X + 8, bounds.Y + 10), new Point(bounds.X + 10, bounds.Y + 10));
         wg.DrawLine(borderPen, new Point(bounds.X, bounds.Y + 4), new Point(bounds.X, bounds.Y + 8));
         wg.DrawLine(borderPen, new Point(bounds.X + 11, bounds.Y + 4), new Point(bounds.X + 11, bounds.Y + 8));
         wg.DrawLine(borderPen, new Point(bounds.X + 1, bounds.Y + 2), new Point(bounds.X + 1, bounds.Y + 4));
         wg.DrawLine(borderPen, new Point(bounds.X + 1, bounds.Y + 8), new Point(bounds.X + 1, bounds.Y + 10));
         wg.DrawLine(borderPen, new Point(bounds.X + 10, bounds.Y + 2), new Point(bounds.X + 10, bounds.Y + 4));
         wg.DrawLine(borderPen, new Point(bounds.X + 10, bounds.Y + 8), new Point(bounds.X + 10, bounds.Y + 10));
     }
 }
示例#3
0
		// Helper method to overcome the poor GDI ellipse drawing routine
		// VSWhidbey #334097
		private static void DrawAndFillEllipse(WindowsGraphics wg, WindowsPen borderPen, WindowsBrush fieldBrush, Rectangle bounds)
		{
            Debug.Assert(wg != null,"Calling DrawAndFillEllipse with null wg");
		    if (wg == null) {
                return;
		    }
            
			wg.FillRectangle(fieldBrush, new Rectangle(bounds.X + 2, bounds.Y + 2, 8, 8));
			wg.FillRectangle(fieldBrush, new Rectangle(bounds.X + 4, bounds.Y + 1, 4, 10));
			wg.FillRectangle(fieldBrush, new Rectangle(bounds.X + 1, bounds.Y + 4, 10, 4));

			wg.DrawLine(borderPen, new Point(bounds.X + 4, bounds.Y + 0), new Point(bounds.X + 8, bounds.Y + 0));
			wg.DrawLine(borderPen, new Point(bounds.X + 4, bounds.Y + 11), new Point(bounds.X + 8, bounds.Y + 11));

			wg.DrawLine(borderPen, new Point(bounds.X + 2, bounds.Y + 1), new Point(bounds.X + 4, bounds.Y + 1));
			wg.DrawLine(borderPen, new Point(bounds.X + 8, bounds.Y + 1), new Point(bounds.X + 10, bounds.Y + 1));

			wg.DrawLine(borderPen, new Point(bounds.X + 2, bounds.Y + 10), new Point(bounds.X + 4, bounds.Y + 10));
			wg.DrawLine(borderPen, new Point(bounds.X + 8, bounds.Y + 10), new Point(bounds.X + 10, bounds.Y + 10));

			wg.DrawLine(borderPen, new Point(bounds.X + 0, bounds.Y + 4), new Point(bounds.X + 0, bounds.Y + 8));
			wg.DrawLine(borderPen, new Point(bounds.X + 11, bounds.Y + 4), new Point(bounds.X + 11, bounds.Y + 8));

			wg.DrawLine(borderPen, new Point(bounds.X + 1, bounds.Y + 2), new Point(bounds.X + 1, bounds.Y + 4));
			wg.DrawLine(borderPen, new Point(bounds.X + 1, bounds.Y + 8), new Point(bounds.X + 1, bounds.Y + 10));

			wg.DrawLine(borderPen, new Point(bounds.X + 10, bounds.Y + 2), new Point(bounds.X + 10, bounds.Y + 4));
			wg.DrawLine(borderPen, new Point(bounds.X + 10, bounds.Y + 8), new Point(bounds.X + 10, bounds.Y + 10));
		}
示例#4
0
 // the DataGridViewButtonCell uses this method
 internal static void PaintButtonBackground(WindowsGraphics wg, Rectangle bounds, WindowsBrush background) {
     wg.FillRectangle(background, bounds);
 }
 private void DrawEllipse(WindowsPen pen, WindowsBrush brush, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
 {
     HandleRef hdc = new HandleRef(this.dc, this.dc.Hdc);
     if (pen != null)
     {
         IntUnsafeNativeMethods.SelectObject(hdc, new HandleRef(pen, pen.HPen));
     }
     if (brush != null)
     {
         IntUnsafeNativeMethods.SelectObject(hdc, new HandleRef(brush, brush.HBrush));
     }
     IntUnsafeNativeMethods.Ellipse(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect);
 }
 public void DrawAndFillEllipse(WindowsPen pen, WindowsBrush brush, Rectangle bounds)
 {
     this.DrawEllipse(pen, brush, bounds.Left, bounds.Top, bounds.Right, bounds.Bottom);
 }
 public void FillRectangle(WindowsBrush brush, int x, int y, int width, int height)
 {
     HandleRef hDC = new HandleRef(this.dc, this.dc.Hdc);
     IntPtr hBrush = brush.HBrush;
     IntNativeMethods.RECT rect = new IntNativeMethods.RECT(x, y, x + width, y + height);
     IntUnsafeNativeMethods.FillRect(hDC, ref rect, new HandleRef(brush, hBrush));
 }
 public void FillRectangle(WindowsBrush brush, Rectangle rect)
 {
     this.FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height);
 }
示例#9
0
 public void DrawAndFillEllipse(WindowsPen pen, WindowsBrush brush, Rectangle bounds)
 => DrawEllipse(pen, brush, bounds.Left, bounds.Top, bounds.Right, bounds.Bottom);
示例#10
0
        // FillRectangle overloads

        public void FillRectangle(WindowsBrush brush, Rectangle rect)
        {
            FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height);
        }
 public WindowsPen(DeviceContext dc, WindowsBrush windowsBrush) : this(dc, WindowsPenStyle.Cosmetic, 1, windowsBrush)
 {
 }
 private void Dispose(bool disposing)
 {
     if ((this.nativeHandle != IntPtr.Zero) && (this.dc != null))
     {
         this.dc.DeleteObject(this.nativeHandle, GdiObjectType.Pen);
         this.nativeHandle = IntPtr.Zero;
     }
     if (this.wndBrush != null)
     {
         this.wndBrush.Dispose();
         this.wndBrush = null;
     }
     if (disposing)
     {
         GC.SuppressFinalize(this);
     }
 }
 public WindowsPen(DeviceContext dc, WindowsBrush windowsBrush) : this(dc, WindowsPenStyle.Cosmetic, 1, windowsBrush)
 {
 }
示例#14
0
 public WindowsPen(DeviceContext dc, WindowsBrush windowsBrush) :
     this(dc, default, CosmeticPenWidth, windowsBrush)
 {
 }