怎样在StringGrid动态撞见CheckBox,可以实现多选。
解决方案 »
- 内存无法释放
- 求助:delphi7 + sqlserver 2000 连接失败
- 关于dbgrid选定行打印问题
- 对Raize组件熟悉的大侠帮帮忙啊
- delphi中如何处理一个从C++写的组件的事件(参数类型是安全数组)呢?
- 安装了Delphi2005的兄弟们注意了,举手之劳,先行谢过
- 如何判断扫描仪是否与计算机相连
- 关于 LstBox 中文问题
- 急!! 如何将 SQLSERVER 里的表导出来?______________Holen
- 一个想不明白的问题,为何还有很多老兄在讨论Filter等方法?用select .. where ..不就搞定了吗?
- 请问下用过indy的朋友,救命啊!!!!!!!!!
- 关于delphi中类强烈转换的问题
动态隔行多选好像不能支持
还有,那个词是创建不是撞见吧?
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, DBCtrls, Grids;type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
procedure FormCreate(Sender: TObject);
procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
var i:Integer;
begin
for i:=1 to 4 do
begin
StringGrid1.Cells[0,i]:=IntToStr(i);
if i mod 2=0 then
StringGrid1.Cells[1,i]:='True'
else StringGrid1.Cells[1,i]:='False';
end;
end;procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
if (ARow>0) and (ACol=2) then
begin
StringGrid1.Canvas.FillRect(Rect);
if SameText(StringGrid1.Cells[ACol-1, ARow],'True') then
DrawFrameControl(StringGrid1.Canvas.Handle, Rect, DFC_BUTTON, DFCS_BUTTONCHECK or DFCS_CHECKED)
else DrawFrameControl(StringGrid1.Canvas.Handle, Rect, DFC_BUTTON, DFCS_BUTTONCHECK)
end
else StringGrid1.Canvas.TextRect(Rect, Rect.Left+2, Rect.Top+2, StringGrid1.Cells[ACol, ARow]);
end;end.