var
bmp, caretbild: TBitmap;
procedure zeigeKursor;
begin
with Form1 do begin
if activecontrol = Richedit1 then begin
createcaret(Richedit1.handle, caretbild.handle, 0, 0);
showcaret(Richedit1.handle);
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var faktor: double;
begin
application.OnActivate := Formpaint;
application.OnRestore := Formpaint;
keypreview := true;
Richedit1.parentfont := true;
Richedit1.color := clwhite;
Richedit1.wantTabs := false;
bmp := TBitmap.create;
bmp.loadfromfile('d:\bilder\arrow.bmp');
faktor := bmp.height / bmp.width;
caretbild := TBitmap.create;
caretbild.height := canvas.textheight('Dummy');
caretbild.width := round(caretbild.height / faktor);
stretchblt(caretbild.canvas.handle, 0, 0, caretbild.width, caretbild.height,
bmp.canvas.handle, 0, 0, bmp.width, bmp.height, NOTSRCCOPY);
bmp.free;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
caretbild.free;
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
zeigeKursor;
end;
procedure TForm1.RichEdit1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
zeigeKursor;
end;
procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
zeigeKursor;
end;