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

StringGrid 的 ondrawcell 中的拖曳問題

答題得分者是:william
P.D.
版主


發表:603
回覆:4038
積分:3874
註冊:2006-10-31

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-12-17 11:45:25 IP:61.71.xxx.xxx 未訂閱
請問各位!    我有一個StringGrid, 定義了 ondrawcell的內容, 現發生一個狀況 我原先設定拖曳方式如下
     with Sender as TStringGrid do begin
       if State=[gdSelected] then begin
         Canvas.Brush.Color:= $0080FFFF; //底色
         Canvas.Font.Color:= clBlack;  //字體顏色
       end
.....
這樣原先是可以達成拖曳時, cell會展現黃色底色, 但如果我把 StringGrid 的 Options 其中一項 goEditing 打開的話, 這項 拖曳就失效了, 但如果以keyboard (shift left,rightkey)還是可以 達成的, 如何調整才可以達成以滑鼠拖曳變色的目標(在goEditing開的情況下) 謝謝!
william
版主


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

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-12-17 12:31:28 IP:147.8.xxx.xxx 未訂閱
I think this is a designed feature, according to the online help you can't do range select in goEditing mode  class="code">procedure TForm1.StringGrid1DblClick(Sender: TObject); begin with TStringGrid(Sender) do begin Options := Options [goEditing]; EditorMode := True; Options := Options - [goEditing]; end; end;
P.D.
版主


發表:603
回覆:4038
積分:3874
註冊:2006-10-31

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-12-17 15:40:17 IP:61.71.xxx.xxx 未訂閱
引言: I think this is a designed feature, according to the online help you can't do range select in goEditing mode class="code">procedure TForm1.StringGrid1DblClick(Sender: TObject); begin with TStringGrid(Sender) do begin Options := Options [goEditing]; EditorMode := True; Options := Options - [goEditing]; end; end;
感謝william兄每次都幫我解開, 還沒有看此回信時, 我有試一個方法 其實與william兄是一樣的, 只是我放在 onMouseMove 中, 我這樣寫 if (ssShift in Shift) then Options:= Options-[goEditing] else Options:= Options [goEditing] 只是在mouse移動時不斷會執行此描述, 不知運作久一點是否會造成當機 或不正常的現象? 原先亦有考慮使用doubleclick, 但因此操作click兩次對有些人操作不易 所以沒有考慮放在這, 我在想是否還有更方便及容易的設計! 另外, 再請教, EditorMode不論指定與否, 似乎只要 option的editing 打開 就可以作業, 那不知EditorMode 真正的功能為何?
william
版主


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

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-12-17 15:54:20 IP:147.8.xxx.xxx 未訂閱
Extracted from Grids.pas:    
procedure TCustomGrid.SetEditorMode(Value: Boolean);
begin
  if not Value then
    HideEditor
  else
  begin
    ShowEditor;
    if FInplaceEdit <> nil then FInplaceEdit.Deselect;
  end;
end;
Setting EditorMode will show/hide the inplace editor of the grid > >
P.D.
版主


發表:603
回覆:4038
積分:3874
註冊:2006-10-31

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-12-18 10:14:12 IP:61.71.xxx.xxx 未訂閱
引言: Extracted from Grids.pas:
procedure TCustomGrid.SetEditorMode(Value: Boolean);
begin
  if not Value then
    HideEditor
  else
  begin
    ShowEditor;
    if FInplaceEdit <> nil then FInplaceEdit.Deselect;
  end;
end;
Setting EditorMode will show/hide the inplace editor of the grid > > < face="Verdana, Arial, Helvetica"> 謝謝說明, 另外一個議題, 我現在已改成用 RADIOBUTTON讓USER選擇 明白顯示一個是拖曳模式, 另一個是編輯模式,我想這樣要教育客戶也簡單的多!
系統時間:2024-06-28 19:23:26
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!