Search code examples
c#nvidiamouse-cursor

cursor with text is cropped when rotating display with nvidia card


I am using a custom developed mouse cursor which renders a bitmap with text beside the mouse pointer. Normally this is working well. However, on some graphics cards (including a geforce 9500), if I rotate the display to portrait mode using nvidia control panel - the text is partially cropped so that only half of the first letter is shown. The partially shown letter seems to be rotated correctly however.

Is this a known issue? Anyone got ideas how this could be happening? (I will try getting relevant parts of code to paste, its a bit much though) I am using windows 7, code in c#.

Edit1: Found something interesting - if the string I write next to the pointer is short (example "Aa") it gets broken, but if it is any longer (say "Aaa") it works well rotated.

Edit2: Here is the problematic code:

int width = cursor.Size.Width + textSize.Width + scrollTokenSize.Width - 10;
int height = cursor.Size.Height;
bitmap = new Bitmap(width, height);

This bitmap is set beside the cursor. The problem (I think) is that height and width are of different size and if I let bitmap use only the largest value, twice, then my text will appear too far away, down from, the pointer (but it is all shown I should mention). Ideas?


Solution

  • For any who are interested, I managed to solve this by adding my non-square bitmap onto a transparent square one. Guess graphics cards assume mouse pointers are squared.