码迷,mamicode.com
首页 > 其他好文 > 详细

AdvStringGrid常用操作

时间:2016-07-21 12:33:02      阅读:852      评论:0      收藏:0      [点我收藏+]

标签:

//设置单元格是否可编辑
procedure TForm1.AdvStringGrid1CanEditCell(Sender: TObject; ARow, ACol: Integer; var CanEdit: Boolean);
var
  i: Integer;
begin
  for i := 0 to AdvStringGrid1.ColCount do
  begin
    CanEdit := False;
  end;
  if ACol = 1 then
    CanEdit := True;
  if ACol = 7 then
    CanEdit := True;
end;
//设置单元格对齐方式
procedure TForm1.AdvStringGrid1GetAlignment(Sender: TObject; ARow, ACol: Integer; var HAlign: TAlignment; var VAlign: TVAlignment);
begin
  if ACol = 1 then
  begin
    HAlign := taCenter;    //TAlignment = (taLeftJustify, taRightJustify, taCenter);
    VAlign := vtaCenter;   //TVAlignment = (vtaTop,vtaCenter,vtaBottom);
  end;
end;
//添加CheckBox
procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
  flag: Boolean;
begin
  //添加CheckBox
  for i := 1 to AdvStringGrid1.RowCount - 1 do
  begin
    AdvStringGrid1.AddCheckBox(1, i, False, false);
  end;
  //判断CheckBox是否选中
  for i := 1 to AdvStringGrid1.RowCount - 1 do
  begin
    AdvStringGrid1.GetCheckBoxState(1, i, flag);
    if flag = true then
    begin
          //如果选中CheckBox进行操作
    end;
  end;
end;

 

AdvStringGrid常用操作

标签:

原文地址:http://www.cnblogs.com/win32pro/p/5691175.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!