Z
zhuxi168
Unregistered / Unconfirmed
GUEST, unregistred user!
我按下列代码写入后,会将所有的列都画有checkbox,而且有些列我不想要有chechbox的Cells的文本内容都被擦掉了,我只想要某一列有Checkbox这个功能。
该如何?敬请高手指点。
procedure TForm1.gridDrawCell(Sender: TObject;
ACol, ARow: Integer;
Rect: TRect;
State: TGridDrawState);
begin
if not (gdFixed in State) then
with TStringGrid(Sender).Canvasdo
begin
brush.Color:=clWindow;
FillRect(Rect);
if Grid.Cells[ACol,ARow]='yes' then
Draw( (rect.right + rect.left - FCheck.width) div 2, (rect.bottom + rect.top - FCheck.height) div 2, FCheck )
else
Draw( (rect.right + rect.left - FCheck.width) div 2, (rect.bottom + rect.top - FCheck.height) div 2, FNoCheck );
end;
end;
该如何?敬请高手指点。
procedure TForm1.gridDrawCell(Sender: TObject;
ACol, ARow: Integer;
Rect: TRect;
State: TGridDrawState);
begin
if not (gdFixed in State) then
with TStringGrid(Sender).Canvasdo
begin
brush.Color:=clWindow;
FillRect(Rect);
if Grid.Cells[ACol,ARow]='yes' then
Draw( (rect.right + rect.left - FCheck.width) div 2, (rect.bottom + rect.top - FCheck.height) div 2, FCheck )
else
Draw( (rect.right + rect.left - FCheck.width) div 2, (rect.bottom + rect.top - FCheck.height) div 2, FNoCheck );
end;
end;