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);
        }
Beispiel #2
0
 public static bool SetViewportOrgEx(HandleRef hDC, int x, int y, [In, Out] IntNativeMethods.POINT point)
 {
     return(IntSetViewportOrgEx(hDC, x, y, point));
 }
Beispiel #3
0
 public static bool OffsetViewportOrgEx(HandleRef hDC, int nXOffset, int nYOffset, [In, Out] IntNativeMethods.POINT point)
 {
     return(IntOffsetViewportOrgEx(hDC, nXOffset, nYOffset, point));
 }
Beispiel #4
0
 public static bool MoveToEx(HandleRef hdc, int x, int y, IntNativeMethods.POINT pt)
 {
     return(IntMoveToEx(hdc, x, y, pt));
 }
Beispiel #5
0
 public static extern bool IntSetViewportOrgEx(HandleRef hDC, int x, int y, [In, Out] IntNativeMethods.POINT point);
Beispiel #6
0
 public static extern bool IntOffsetViewportOrgEx(HandleRef hDC, int nXOffset, int nYOffset, [In, Out] IntNativeMethods.POINT point);
Beispiel #7
0
 public static extern bool IntMoveToEx(HandleRef hdc, int x, int y, IntNativeMethods.POINT pt);
Beispiel #8
0
 public static extern bool IntGetViewportOrgEx(HandleRef hdc, [In, Out] IntNativeMethods.POINT lpPoint);
Beispiel #9
0
 public static bool GetViewportOrgEx(HandleRef hdc, [In, Out] IntNativeMethods.POINT lpPoint)
 {
     return(IntGetViewportOrgEx(hdc, lpPoint));
 }
Beispiel #10
0
 public void TranslateTransform(int dx, int dy)
 {
     IntNativeMethods.POINT point = new IntNativeMethods.POINT();
     IntUnsafeNativeMethods.OffsetViewportOrgEx(new HandleRef(this, this.Hdc), dx, dy, point);
 }
Beispiel #11
0
 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());
 }