예제 #1
0
        public static bool SetViewportOrgEx(HandleRef hDC, int x, int y, [In, Out] IntNativeMethods.POINT point)
        {
            bool retVal = IntSetViewportOrgEx(hDC, x, y, point);

            DbgUtil.AssertWin32(retVal, "SetViewportOrgEx([hdc=0x{0:X8}], x=[{1}], y=[{2}], [out point]) failed.", hDC.Handle, x, y);
            return(retVal);
        }
예제 #2
0
        /// <devdoc>
        ///     Sets the DC Viewport origin to the specified value and returns its previous value; origin values are in device units.
        /// </devdoc>
        public Point SetViewportOrigin(Point newOrigin)
        {
            IntNativeMethods.POINT oldOrigin = new IntNativeMethods.POINT();
            IntUnsafeNativeMethods.SetViewportOrgEx(new HandleRef(this, this.Hdc), newOrigin.X, newOrigin.Y, oldOrigin);

            return(oldOrigin.ToPoint());
        }
예제 #3
0
        public static bool GetViewportOrgEx(HandleRef hdc, [In, Out] IntNativeMethods.POINT lpPoint)
        {
            bool retVal = IntGetViewportOrgEx(hdc, lpPoint);

            DbgUtil.AssertWin32(retVal, "GetViewportOrgEx([hdc=0x{0:X8}], [out point]) failed.", hdc.Handle);
            return(retVal);
        }
예제 #4
0
        public static bool MoveToEx(HandleRef hdc, int x, int y, IntNativeMethods.POINT pt)
        {
            bool retVal = IntMoveToEx(hdc, x, y, pt);

            DbgUtil.AssertWin32(retVal, "MoveToEx(hdc=[0x{0:X8}], x=[{1}], y=[{2}], pt=[{3}] failed.", hdc.Handle, x, y, pt);
            return(retVal);
        }
예제 #5
0
        public void DrawLine(WindowsPen pen, int x1, int y1, int x2, int y2)
        {
            HandleRef hdc = new HandleRef(this.dc, this.dc.Hdc);

            DeviceContextBinaryRasterOperationFlags rasterOp = this.dc.BinaryRasterOperation;
            DeviceContextBackgroundMode             bckMode  = this.dc.BackgroundMode;

            if (rasterOp != DeviceContextBinaryRasterOperationFlags.CopyPen)
            {
                rasterOp = this.dc.SetRasterOperation(DeviceContextBinaryRasterOperationFlags.CopyPen);
            }

            if (bckMode != DeviceContextBackgroundMode.Transparent)
            {
                bckMode = this.dc.SetBackgroundMode(DeviceContextBackgroundMode.Transparent);
            }

            if (pen != null)
            {
                this.dc.SelectObject(pen.HPen, GdiObjectType.Pen);
            }

            IntNativeMethods.POINT oldPoint = new IntNativeMethods.POINT();

            IntUnsafeNativeMethods.MoveToEx(hdc, x1, y1, oldPoint);
            IntUnsafeNativeMethods.LineTo(hdc, x2, y2);

            if (bckMode != DeviceContextBackgroundMode.Transparent)
            {
                this.dc.SetBackgroundMode(bckMode);
            }

            if (rasterOp != DeviceContextBinaryRasterOperationFlags.CopyPen)
            {
                this.dc.SetRasterOperation(rasterOp);
            }

            IntUnsafeNativeMethods.MoveToEx(hdc, oldPoint.x, oldPoint.y, null);
        }
예제 #6
0
        /// <devdoc>
        ///     Modifies the viewport origin for a device context using the specified horizontal and vertical offsets in logical units.
        /// </devdoc>


        public void TranslateTransform(int dx, int dy)
        {
            IntNativeMethods.POINT orgn = new IntNativeMethods.POINT();
            IntUnsafeNativeMethods.OffsetViewportOrgEx(new HandleRef(this, this.Hdc), dx, dy, orgn);
        }
예제 #7
0
 public static extern bool IntSetViewportOrgEx(HandleRef hDC, int x, int y, [In, Out] IntNativeMethods.POINT point);
예제 #8
0
 public static extern bool IntGetViewportOrgEx(HandleRef hdc, [In, Out] IntNativeMethods.POINT lpPoint);
예제 #9
0
 public static extern bool IntMoveToEx(HandleRef hdc, int x, int y, IntNativeMethods.POINT pt);
예제 #10
0
        public static bool OffsetViewportOrgEx(HandleRef hDC, int nXOffset, int nYOffset, [In, Out] IntNativeMethods.POINT point)
        {
            bool retVal = IntOffsetViewportOrgEx(hDC, nXOffset, nYOffset, point);

            DbgUtil.AssertWin32(retVal, "OffsetViewportOrgEx([hdc=0x{0:X8}], dx=[{1}], dy=[{2}], [out pPoint]) failed.", hDC.Handle, nXOffset, nYOffset);
            return(retVal);
        }
예제 #11
0
 public static extern bool IntOffsetViewportOrgEx(HandleRef hDC, int nXOffset, int nYOffset, [In, Out] IntNativeMethods.POINT point);
 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();
 }
        /// <include file='doc\WindowsGraphics.uex' path='docs/doc[@for="WindowsGraphics.DrawLine3"]/*' />
        public void DrawLine(WindowsPen pen, int x1, int y1, int x2, int y2)
        {
            HandleRef hdc  = new HandleRef(this.dc, this.dc.Hdc);
            
            DeviceContextBinaryRasterOperationFlags rasterOp = this.dc.BinaryRasterOperation;
            DeviceContextBackgroundMode bckMode = this.dc.BackgroundMode;

            if( rasterOp != DeviceContextBinaryRasterOperationFlags.CopyPen )
            {
                rasterOp = this.dc.SetRasterOperation( DeviceContextBinaryRasterOperationFlags.CopyPen );
            }

            if( bckMode != DeviceContextBackgroundMode.Transparent )
            {
                bckMode = this.dc.SetBackgroundMode( DeviceContextBackgroundMode.Transparent );
            }

            if (pen != null)
            {
                this.dc.SelectObject(pen.HPen, GdiObjectType.Pen);
            }

            IntNativeMethods.POINT oldPoint = new IntNativeMethods.POINT();

            IntUnsafeNativeMethods.MoveToEx(hdc, x1, y1, oldPoint);
            IntUnsafeNativeMethods.LineTo(hdc, x2, y2);

            if( bckMode != DeviceContextBackgroundMode.Transparent )
            {
                this.dc.SetBackgroundMode( bckMode );
            }

            if( rasterOp != DeviceContextBinaryRasterOperationFlags.CopyPen )
            {
                this.dc.SetRasterOperation( rasterOp );
            }
            
            IntUnsafeNativeMethods.MoveToEx(hdc, oldPoint.x, oldPoint.y, null);
        }