Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET3.5 C# GDI+ WinForm Win8
Hi,
 
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)?
 
Thanks!
 
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 10-Jul-13 0:09am
vmp5304

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

  Print Answers RSS
0 OriginalGriff 406
1 /\jmot 180
2 Suraj Sahoo | Coding Passion 170
3 BillWoodruff 159
4 Afzaal Ahmad Zeeshan 154
0 OriginalGriff 8,344
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,634
3 Maciej Los 5,024
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 10 Jul 2013
Copyright © CodeProject, 1999-2014
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