Советы по Delphi

         

Позиция курсора в TRichEdit


    Procedure TForm1.GetPosition(Sender: TRichEdit);
var
iX,iY  : Integer; TheRichEdit : TRichEdit; begin
iX := 0; iY := 0; TheRichEdit := TRichEdit(Sender); iY := SendMessage(TheRichEdit.Handle, EM_LINEFROMCHAR, TheRichEdit.SelStart, 0); iX := TheRichEdit.SelStart - SendMessage(TheRichEdit.Handle, EM_LINEINDEX, iY, 0);

Panel1.Caption := IntToStr(iY + 1) + ':' + IntToStr(iX + 1) ; end;

procedure TForm1.RichEditMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin
GetPosition(RichEdit); end;

procedure TForm1.RichEditKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState); begin
GetPosition(RichEdit); end;

[001495]



Содержание раздела