Unplanned
Last Updated: 12 Nov 2019 14:58 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 16 Nov 2018 07:08
Category: UI for WinForms
Type: Bug Report
3
FIX. TPF - pixelated Cursors.Hand should be improved
To reproduce: add a RadLabel and change its cursor to Hand.

 this.radLabel1.Cursor = Cursors.Hand;

The PixelatedHandCursor.png shows the poor quality of the cursor which should be improved.

Workaround: https://stackoverflow.com/questions/6016995/un-antialiased-hand-cursor-in-windows-forms-apps/6017174#6017174

    public class LinkLabelEx : RadLabel
    {
        private const int WM_SETCURSOR = 0x0020;
        private const int IDC_HAND = 32649;

        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern IntPtr LoadCursor(IntPtr hInstance, int lpCursorName);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        private static extern IntPtr SetCursor(IntPtr hCursor);

        protected override void WndProc(ref Message m)
        {
            if (m.Msg == WM_SETCURSOR)
            {
                // Set the cursor to use the system hand cursor
                SetCursor(LoadCursor(IntPtr.Zero, IDC_HAND));

                // Indicate that the message has been handled
                m.Result = IntPtr.Zero;
                return;
            }

            base.WndProc(ref m);
        }
    }

The ImprovedCursorRendering.png  shows the improved cursor. 
0 comments