Click here to Skip to main content
13,046,464 members (75,300 online)
Rate this:
Please Sign up or sign in to vote.

I use custom cursors for dragdrop-operations. In remote desktop sessions only if remote machine runs Win8 the session completely freezes, if the cursor exceeds a certain size.
It works fine, if you work on physical Win8 machine or e.g. Xen Console. Also works fine on RDP with other target operating systems (Win7, Server 2008R2...)

I tried to break down the problem to the most simple case.
In the example below Cursors of 32x32 and 64x64 work fine, 200x200 just dont display anything, 500x500 will freeze everything (system hangs).

I debugged and logged everything, hang occurs _after_ code is completed and cursor is returned.

Can anyone give me some advice in which direction to go, as I'm quite clueless meanwhile. Is there another state-of-the-art way meanwhile to manipulate mouse cursors in winforms applications (i use .net 3.5)?


private void button_Click(object sender, EventArgs e)
    //will be 32 from firstbutton, 64 from second, 200 from third, 500 from fourth
    int iCursorSizeFromButton = int.Parse((string)(sender as Button).Tag);
    Bitmap bnew = new Bitmap(iCursorSizeFromButton, iCursorSizeFromButton);
    using (Graphics g = Graphics.FromImage(bnew))
        using (Brush b = new SolidBrush(Color.FromArgb(127, Color.LightBlue)))
            g.FillRectangle(b, new Rectangle(0, 0, bnew.Width, bnew.Height)); //make bitmap for simple custom cursor
            g.DrawEllipse(Pens.Black, new Rectangle(bnew.Width / 2 - 2, bnew.Height / 2 - 2, 4, 4)); //show hotspot, to know how to click
        IntPtr Hicon = bnew.GetHicon();
        Cursor c = new Cursor(Hicon);
        this.Cursor = c;
        //we dont call "extern static bool DestroyIcon(IntPtr handle)" for old cursors in this sample, because it's irrelevant for test
Posted 9-Jul-13 23:09pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 10 Jul 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100