سؤال

Since I can't find ZoomIn and/or ZoomOut magnifying glass cursor for my program, I created my own cursor of size 32 by 32 4bit with my compiler. However, when I do assign it to my form cursor, it is not displayed at all, whereas 16 by 16 4bit BMP cursor is properly displayed as expected.

Am I missing something or is this size not allowed as of now or do I have to do something to make it work?

Here is how it is set:

Mainform.Cursor := new Cursor(baseDir+'\ZoomIn.Cur');

enter image description here

This is what I see after saving 32 by 32 cursor file in the windows explorer.

enter image description here

Normally, you should see tiny version of the cursor right next the cursor file name, but I see none.

Thanks in advance,

هل كانت مفيدة؟

المحلول

Windows (at least the .NET Cursor class) doesn't appear to like icons that are more than 1-bit black and white images.

32x32 bit are still supported. I tested using one of the old CodeGear Shared\Images\Cursors images, as well as a new cursor created in GreenFish Icon Editor and in the Visual Studio Image Editor (File->New File->Cursor file), using the following code:

method MainForm.MainForm_Load(sender: System.Object; e: System.EventArgs);
begin
  self.Cursor := new Cursor('E:\code\XHAIR1.CUR');
end;

So reducing the color depth to 1-bit should make it work for you.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top