Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Bitmap2Cursor Funktionsfehler unter Win95/98/ME (https://www.delphipraxis.net/70914-bitmap2cursor-funktionsfehler-unter-win95-98-me.html)

D11 6. Jun 2006 18:34


Bitmap2Cursor Funktionsfehler unter Win95/98/ME
 
Erstelle mit dieser Funktion aus zwei 24x24 Bitmap's (in 16 Farben) einen "Symbol" Mauszeiger Cursor.

Ein Bild ist immer gleich (Pfeil) - das andere wechselt (Symbol)- der Hintergrund der gelöscht werden soll
ist bei allen Bildern immer gleich, so das geht auch alles prima - unter Windows 2000/NT/XP/Vista
aber...
unter Windows 95/98/ME ist der so erzeugte Mauszeiger bzw. genau "die Hintergrundfarbe" als "dunkelgrau" sichtbar?

Hmmmm... jemand eine Idee hierzu?

Delphi-Quellcode:
// var XPonPC: boolean;
// wird z.Z. vorher geprüft ob XP on System

function Bitmap2Cursor(Bitmap: TBitmap): HCursor;
var
   IconInfo: TIconInfo;
begin
     try
     if (XPonPC) then begin
     BitBlt(cursorbild32.Canvas.Handle,8,8,32,32,bitmap.Canvas.Handle,0,0,SRCCOPY);
     IconInfo.fIcon := False;
     IconInfo.hbmColor := cursorbild32.Handle;
     IconInfo.hbmMask := bildmask32.Handle
     end else begin
     cursorbild32.Canvas.Draw(8,8,Bitmap);
     IconInfo.fIcon := False;
     IconInfo.hbmColor := cursorbild32.Handle;
     IconInfo.hbmMask := cursorbild32.MaskHandle;
     end;
     
     IconInfo.xHotspot := 1;
     IconInfo.yHotspot := 1;

     Result := CreateIconIndirect(IconInfo);

   except begin
   Result := Screen.Cursors[crHandPoint];
   end; end;
end;
Rest nur zur weiteren Info!
Delphi-Quellcode:
procedure HighSpeedChangeColor(ID: Word; Org: TBitmap; NeueFarbe: TColor);
var links,oben,wert: Word;
begin
  case neuefarbe of
  clyellow: begin
BitBlt(org.Canvas.Handle,0,0,Org.Width,Org.Height,gbbildgelb.Canvas.Handle,links,oben,SRCCOPY);
            end;
//ect. ect.
end;
Delphi-Quellcode:
procedure Maus_Cursor_setzen;
var zeichenbild: TBitmap;
begin
zeichenbild := TBitmap.Create;
try
zeichenbild.PixelFormat := pf4bit;
zeichenbild.Canvas.Brush.Style := bsSolid;
zeichenbild.Canvas.Brush.Color := FormGB.PaintBoxGB.Color;
zeichenbild.Canvas.Pen.Style := psSolid;
zeichenbild.Canvas.Pen.Color := FormGB.PaintBoxGB.Color;
zeichenbild.TransparentMode := tmfixed;
zeichenbild.TransparentColor := FormGB.PaintBoxGB.Color;
zeichenbild.Width := 24;
zeichenbild.Height := 24;
zeichenbild.Dormant;
zeichenbild.FreeImage;
zeichenbild.IgnorePalette := true;

HighSpeedChangeColor(gbzielbild,zeichenbild,clyellow);
// ect. ect.
try
// In den Cursor
 Screen.Cursors[9999] := Bitmap2Cursor(zeichenbild);
// sofort anzeigen
 FormGB.PaintBoxGB.Cursor := 9999;
finally zeichenbild.free; end;
end;
*gesamter Quelltext einsehbar auf meiner Homepage

mfg


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:17 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz