procedure TManageProjForm.dbgrdhProjectDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
var
btnName,IconName:string;
i :integer;
btn:TSuiButton;
Icon:TBitmap;
begin
if TADOQuery(TDBGridEh(Sender).DataSource.DataSet).Active = False then
begin
Exit;
end;
if Column.Title.Caption ='操作' then
begin
btnName := 'btn_'+intToStr(adoQryFindProject.RecNo);
if self.FindComponent(btnName) = nil then
begin
btn := TSuiButton.Create(self);
btn.FileTheme := FormDataModule.suiFileTheme1;
btn.UIStyle := FromThemeFile;
btn.Caption := '删除';
btn.Name := btnName;
btn.Parent:= self;
btn.OnClick := btnMyClick ;
end
else
btn := TSuiButton(self.FindComponent(btnName));
btn.Left := TDBGridEh(Sender).Left + Rect.Left + 5;
btn.top:=TDBGridEh(Sender).top +Rect.top +3;
btn.Width:= Rect.Right-Rect.Left-5;
btn.Height:= Rect.Bottom-Rect.top-3;
btn.SetMouseLeave;
//把多余的按钮清除
i := adoQryFindProject.RecordCount+1;
btnName := 'btn_'+intToStr(i);
while(self.FindComponent(btnName) <> nil) do
begin
TSuiButton(self.FindComponent(btnName)).Free;
i := i+1;
btnName := 'btn_'+intToStr(i);
end;
end;
end;