Autor Beitrag
Masterhawk
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 92

Win 2000,Win XP
D6 Pers
BeitragVerfasst: Sa 27.08.05 00:24 
Wie kann unter Delphi einen eigenen Mauscursor integrieren?
Dieser soll dann unter Form1.Cursor ausgewählbar sein....Hoffe ihr könnt mir helfen...
Amateur
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 777

(Win98, WinMe) WinXP Prof
D3 Prof, D6 Pers, D2k5 Pers., Turbo C++ Explorer
BeitragVerfasst: Sa 27.08.05 01:01 
eigenen cursor einbinden: (anstatt fadenkreuz nimmste nen anderen namen für cursor und/oder res datei)

.res datei mit cursor erstellen...(im imageeditor von borland)

.res einbinden:

{$R Fadenkreuz1.res}

konstante:(ab 0 aufwärts)

const FADENKREUZ = 1;

cursor aus .res laden, in liste der cursors einfügen (dazu die constante) und zuweisen:

Screen.Cursors[FADENKREUZ] := LoadCursor(HInstance, 'FADENKREUZ');
form1.Cursor:=FADENKREUZ;

_________________
"Kein dummes Gerede. Kein Rumrätseln. Denkt an nichts anderes mehr, nur noch an das, was vor euch liegt. Das ist die wahre Herausforderung. Ihr müßt euch vor euch selbst schützen, Leute." (Rennes in "Cube")
Beiträge: >700
Masterhawk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 92

Win 2000,Win XP
D6 Pers
BeitragVerfasst: Sa 27.08.05 13:18 
Mein Code sieht jetzt so aus...
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
unit mForm1;

const FADENKREUZ=1;

procedure TForm1.FormActivate(Sender: TObject);
begin
...
  Screen.Cursors[FADENKREUZ] := LoadCursor(HInstance, 'Cursor1');
  Form1.Cursor:=Fadenkreuz;
end;


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
program G4DPlay3;

uses
  Forms,
  Grund in 'mForm1.pas' {Form1};


{$R Cursors.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.


Bei ausführen kommt aber nur ein normaler Pfeil als Mauszeiger....
Amateur
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 777

(Win98, WinMe) WinXP Prof
D3 Prof, D6 Pers, D2k5 Pers., Turbo C++ Explorer
BeitragVerfasst: Sa 27.08.05 21:36 
{$R Cursors.res}
muss bei implementation unter {$R *.dfm}

also so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
implementation

{$R Cursors.res}
{$R *.dfm}

außerdem muss bei LoadCursor(HInstance, 'Cursor1'); hinten der name des cursors stehn wie du ihn in deiner res abgespeichert hast... da sollte man immer besser nen anderen name verwenden und nicht einfach cursor1...

ansonsten haste was bei deiner res falsch gemacht...

wenns also mit den tipps oben net geht einfach nochma ne neue res machen

_________________
"Kein dummes Gerede. Kein Rumrätseln. Denkt an nichts anderes mehr, nur noch an das, was vor euch liegt. Das ist die wahre Herausforderung. Ihr müßt euch vor euch selbst schützen, Leute." (Rennes in "Cube")
Beiträge: >700
Masterhawk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 92

Win 2000,Win XP
D6 Pers
BeitragVerfasst: So 28.08.05 12:20 
Vielen Dank, es hat geklappt....