DbGrid的問題 |
答題得分者是:hagar
|
mm
一般會員 發表:7 回覆:11 積分:8 註冊:2002-08-16 發送簡訊給我 |
|
hagar
版主 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
參考 Borland FAQ List 這篇:
Question: Is there a way to figure out the coordinates
(specifically, left and top) of the currently selected
Cell in a DBGrid
Answer: If you have globally declared variables 'CurrentLeft'
and 'CurrentTop', you can keep their values current via the
OnDrawDataCell event:
var CurrentLeft, CurrentTop, CurrentHeight: Integer; procedure TMainForm.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState); begin if gdFocused in State then begin CurrentLeft := Rect.Left; CurrentTop := Rect.Top; CurrentHeight := Rect.Bottom - Rect.Top; end; end;如此記錄 Focus 所在 Cell 的 Rect 值, 那第二個 Field 的 x 座標 = CurrentLeft, y 座標 = CurrentTop CurrentHeight |
天外來客
初階會員 發表:22 回覆:199 積分:44 註冊:2001-11-27 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |