全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1446
推到 Plurk!
推到 Facebook!

DbGrid的問題

答題得分者是:hagar
mm
一般會員


發表:7
回覆:11
積分:8
註冊:2002-08-16

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-09-11 18:18:44 IP:61.220.xxx.xxx 未訂閱
各位前輩你好 我有一個 DbGrid1 的問題 請問當我在 DbGrid1 的第二筆資料的第二個 field 的作dblclick時 如何得到 DbGrid1 的第三筆資料的第二個 field 的x,y座標 因為我想把 DbGrid2 show在這個x,y的位置給user作資料選擇 謝謝
hagar
版主


發表:143
回覆:4056
積分:4445
註冊:2002-04-14

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-09-12 09:12:48 IP:211.22.xxx.xxx 未訂閱
參考 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

發送簡訊給我
#3 引用回覆 回覆 發表時間:2002-09-12 09:38:12 IP:61.220.xxx.xxx 未訂閱
謝謝前輩指導ok了
系統時間:2024-04-26 5:01:41
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!