stringgird有checkbox可以選嗎 |
尚未結案
|
pricejit2
一般會員 發表:53 回覆:18 積分:14 註冊:2005-01-28 發送簡訊給我 |
|
supman
尊榮會員 發表:29 回覆:770 積分:924 註冊:2002-04-22 發送簡訊給我 |
|
odyaho
初階會員 發表:60 回覆:104 積分:42 註冊:2005-02-15 發送簡訊給我 |
|
wameng
版主 發表:31 回覆:1336 積分:1188 註冊:2004-09-16 發送簡訊給我 |
簡單作法。臨時寫的....
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); Var Flags : Integer; begin if (ARow>0) and (ACol=2) then begin StringGrid1.Canvas.FillRect(Rect); Inc(Rect.Top,4); Dec(Rect.Bottom,4); Flags := DFCS_BUTTONCHECK; if StringGrid1.Cells[ACol,ARow]='1' then Flags := Flags or DFCS_CHECKED; DrawFrameControl(StringGrid1.Canvas.Handle,Rect,DFC_BUTTON,Flags ); end; end; procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer; var CanSelect: Boolean); begin { 若Grid 不允許修改編輯。則可省略此段處理} if (ARow>0) and (ACol=2) then begin StringGrid1.Options := StringGrid1.Options - [goEditing]; StringGrid1.EditorMode := False; end else StringGrid1.Options := StringGrid1.Options [goEditing]; end; procedure TForm1.StringGrid1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin With StringGrid1 do if (Row>0) and (Col=2) then begin Cells[Col,Row] := inttostr(ORD(Cells[Col,Row]<>'1')); end; end;~~~~~~~~~~~ 難得聰明,常常糊塗。 ~~~~~~~~~~~ |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |