public void DrawLine(WindowsPen pen, int x1, int y1, int x2, int y2) { HandleRef hdc = new HandleRef(this.dc, this.dc.Hdc); DeviceContextBinaryRasterOperationFlags binaryRasterOperation = this.dc.BinaryRasterOperation; DeviceContextBackgroundMode backgroundMode = this.dc.BackgroundMode; if (binaryRasterOperation != DeviceContextBinaryRasterOperationFlags.CopyPen) { binaryRasterOperation = this.dc.SetRasterOperation(DeviceContextBinaryRasterOperationFlags.CopyPen); } if (backgroundMode != DeviceContextBackgroundMode.Transparent) { backgroundMode = this.dc.SetBackgroundMode(DeviceContextBackgroundMode.Transparent); } if (pen != null) { this.dc.SelectObject(pen.HPen, GdiObjectType.Pen); } IntNativeMethods.POINT pt = new IntNativeMethods.POINT(); IntUnsafeNativeMethods.MoveToEx(hdc, x1, y1, pt); IntUnsafeNativeMethods.LineTo(hdc, x2, y2); if (backgroundMode != DeviceContextBackgroundMode.Transparent) { this.dc.SetBackgroundMode(backgroundMode); } if (binaryRasterOperation != DeviceContextBinaryRasterOperationFlags.CopyPen) { this.dc.SetRasterOperation(binaryRasterOperation); } IntUnsafeNativeMethods.MoveToEx(hdc, pt.x, pt.y, null); }
public static bool SetViewportOrgEx(HandleRef hDC, int x, int y, [In, Out] IntNativeMethods.POINT point) { return(IntSetViewportOrgEx(hDC, x, y, point)); }
public static bool OffsetViewportOrgEx(HandleRef hDC, int nXOffset, int nYOffset, [In, Out] IntNativeMethods.POINT point) { return(IntOffsetViewportOrgEx(hDC, nXOffset, nYOffset, point)); }
public static bool MoveToEx(HandleRef hdc, int x, int y, IntNativeMethods.POINT pt) { return(IntMoveToEx(hdc, x, y, pt)); }
public static extern bool IntSetViewportOrgEx(HandleRef hDC, int x, int y, [In, Out] IntNativeMethods.POINT point);
public static extern bool IntOffsetViewportOrgEx(HandleRef hDC, int nXOffset, int nYOffset, [In, Out] IntNativeMethods.POINT point);
public static extern bool IntMoveToEx(HandleRef hdc, int x, int y, IntNativeMethods.POINT pt);
public static extern bool IntGetViewportOrgEx(HandleRef hdc, [In, Out] IntNativeMethods.POINT lpPoint);
public static bool GetViewportOrgEx(HandleRef hdc, [In, Out] IntNativeMethods.POINT lpPoint) { return(IntGetViewportOrgEx(hdc, lpPoint)); }
public void TranslateTransform(int dx, int dy) { IntNativeMethods.POINT point = new IntNativeMethods.POINT(); IntUnsafeNativeMethods.OffsetViewportOrgEx(new HandleRef(this, this.Hdc), dx, dy, point); }
public Point SetViewportOrigin(Point newOrigin) { IntNativeMethods.POINT point = new IntNativeMethods.POINT(); IntUnsafeNativeMethods.SetViewportOrgEx(new HandleRef(this, this.Hdc), newOrigin.X, newOrigin.Y, point); return(point.ToPoint()); }