delphi实现TDBGrid选中行单元格按钮的显示

1.增加按钮,并隐藏;

2.监听TDBGrid的DrawColumnCell事件,在事件处理中

  if gdSelected  in state then
  begin
   if (Column.FieldName = ' ' ) then
   begin
      spsknbtnDelete.Left := Rect.Left + spskndbgrdForder.Left;
      spsknbtnDelete.Top := Rect.Top + spskndbgrdForder.top;
      spsknbtnDelete.Width := Rect.Right - Rect.Left;
      spsknbtnDelete.Height := Rect.Bottom - Rect.Top;
      spsknbtnDelete.Visible := True;
      spsknbtnDelete.BringToFront;
   end;
  end;


未解疑惑:

DrawDataCell事件怎么不会响应?

你可能感兴趣的:(delphi实现TDBGrid选中行单元格按钮的显示)