/// <summary>
        /// Queries WM_POINTER device/screen rectangles
        /// </summary>
        /// <returns>
        /// True if initialization succeeds, false otherwise.
        /// </returns>
        private bool TryInitializeDeviceRects()
        {
            bool success = false;

            var deviceRect  = new UnsafeNativeMethods.RECT();
            var displayRect = new UnsafeNativeMethods.RECT();

            success = UnsafeNativeMethods.GetPointerDeviceRects(_deviceInfo.device, ref deviceRect, ref displayRect);

            if (success)
            {
                DeviceRect = deviceRect;

                DisplayRect = displayRect;

                // We use the max X and Y properties here as this is more readily useful for raw data
                // which is where all conversions come from.
                SizeInfo = new TabletDeviceSizeInfo(
                    new Size(SupportedPointerProperties[StylusPointDescription.RequiredXIndex].logicalMax,
                             SupportedPointerProperties[StylusPointDescription.RequiredYIndex].logicalMax),
                    new Size(displayRect.right - displayRect.left, displayRect.bottom - displayRect.top));
            }

            return(success);
        }
        public static void SetPadding(this RichTextBox textBox, int padding)
        {
            var rect = new UnsafeNativeMethods.RECT();

            UnsafeNativeMethods.SendMessageRect(
                textBox.Handle,
                UnsafeNativeMethods.EM_GETRECT,
                0,
                ref rect);

            var newRect = new UnsafeNativeMethods.RECT(
                padding,
                padding,
                rect.Right - padding * 2,
                rect.Bottom - padding * 2);

            UnsafeNativeMethods.SendMessageRect(
                textBox.Handle,
                UnsafeNativeMethods.EM_SETRECT,
                0,
                ref newRect);
        }
Exemplo n.º 3
0
 public void GetScreenExt(out UnsafeNativeMethods.RECT rect)
 {
     rect = new UnsafeNativeMethods.RECT();
 }
Exemplo n.º 4
0
 public void GetTextExt(int start, int end, out UnsafeNativeMethods.RECT rect, out bool clipped)
 {
     rect    = new UnsafeNativeMethods.RECT();
     clipped = false;
 }