線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1929
推到 Plurk!
推到 Facebook!

請問要如何知道游標在Edit裡的位置呢??

答題得分者是:sos_admin
rickychung
一般會員


發表:9
回覆:7
積分:3
註冊:2003-08-03

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-09-04 15:46:01 IP:211.21.xxx.xxx 未訂閱
請問要如何知道游標在Edit裡的位置呢?? 當鍵盤按下左右方向鍵時或用滑鼠移動Edit內的游標位址 要如何知道游標的位址呢??
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-09-04 16:19:33 IP:147.8.xxx.xxx 未訂閱
From Delphi help:    SelStart property (TCustomEdit)    Specifies the position of the first selected character in the text.    Delphi syntax:    property SelStart: Integer;    C++ syntax:    __property int SelStart = {read=GetSelStart, write=SetSelStart, nodefault};    Description    Read SelStart to determine the position of the first selected character, where 0 indicates the first character. If there is no selected text, SelStart indicates the position of the cursor. Set SelStart to remove the current selection and position the cursor just before the indicated character. To select a particular range of the text, first set SelStart to position the cursor, and then set SelLength to extend the selection. Also the API GetCaretPos may be useful.
sos_admin
版主


發表:121
回覆:697
積分:768
註冊:2003-07-23

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-09-07 17:13:21 IP:61.155.xxx.xxx 未訂閱
procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); begin label1.Caption :=inttostr((sender as Tedit).SelStart); end;
系統時間:2024-05-18 13:49:56
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!