Why do I have mouse cursor artifacts when setting up a portrait monitor?

I have a delphi application that loads custom mouse cursors with LoadImage(Hinstance, PWideChar(Name), IMAGE_CURSOR, 0, 0, LR_DEFAULTCOLOR);

. These custom cursors are 32x32, 48x48, or 64x64, depending on the user's choice. If I load a custom cursor and move the mouse outside of the application, the cursor changes to the default (arrow). But this arrow now has artifacts on the underside of the cursor. Also artifacts change depending on the previously loaded custom cursor and the size that it includes, for example 64x64 rect.

I tried to take a screenshot but the artifacts do not appear on it. So I wrote this phenomenon to give you an idea of ​​what it looks like.

enter image description here

What I have found so far. All items in the following list must be applied:

  • This only happens when the custom mouse cursor is 32x32.
  • This only happens when the monitor is set to portrait mode.
  • This only happens if the mouse shadow is active.
  • This only happens if the mouse trail is disabled.
  • This only happens with an NVIDIA graphics card.
  • This only happens when the DPI value is 100%.

The following code example demonstrates a cursor issue. Just create a new VCL Form project and add it to the appropriate block.

unit Unit6;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs;

const
   crMyCursor = 1;

type
  TForm6 = class(TForm)
    procedure FormShow(Sender: TObject);
  end;

var
  Form6: TForm6;

implementation

{$R *.dfm}

procedure TForm6.FormShow(Sender: TObject);
begin
  Screen.Cursors[crMyCursor] := LoadImage(Hinstance, PWideChar('MAINICON'), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
  Screen.Cursor := crMyCursor;
end;

end.

      

UPDATE: It used to be an issue with NVIDIA graphics cards. Artifacts appear with graphics cards: GeForce 9600 GT, GeForce GT 630 and GeForce GTX 660. I also tested Intel Onboard graphics cards and ATI graphics cards, and artifacts do not appear with these settings.

So can someone tell me why these artifacts appear and how do I get rid of them?

+3


source to share


1 answer


Due to bugs in graphics drivers and similar things happen for some ATI users .
However, this is not a problem with Delphi or even with custom mice.

I experienced the same phenomenon (strange line artifact following under the mouse cursor), but only on the desktop, on my side, with portrait monitors upside down (NB, I'm running gtx680, so your list isn't exhaustive).



The problem is shading. Both answers here work, but obviously if you like shadows, the current correct answer (switching monitors back to landscape and then returning to the prompt Keep these settings?

) will suit you better.

+1


source







All Articles