带有通配符的Delphi dbgrid

时间:2016-08-24 11:15:12

标签: delphi

我有DBGrid。有时候,如果我改变一些单元格值,它会给出一个通配符。你可以在图像中看到它。

img

我的问题:当这个通配符时,它可以出现吗?如何禁用它?

1 个答案:

答案 0 :(得分:6)

*表示您的dbgrid处于插入模式。

如果您不希望显示此指示符,可以在OnDrawColumnCell事件中更改(绘图)。 如果您使用此活动,则可能需要将dbGrid.DefaultDrawing设置为false。

另请参阅:http://docwiki.embarcadero.com/RADStudio/Seattle/en/Controlling_Grid_Drawing

另一个选择是实现自己的自定义样式。

type
  TMyStyleWithNoIndicator = class(TCustomStyleServices)
    function GetElementDetails(Detail: TThemedGrid): TThemedElementDetails; override;  
  end;

  function TMyStyleWithNoIndicator.GetElementDetails(Detail: TThemedGrid): TThemedElementDetails; 
  begin
    inherited;
    //prevent drawing of the insert indicator.
    if Detail in [tgIndicatorInsert] then Result.State = Ord(tgCellNormal);
  end;

  procedure TForm1.Form1Create(Sender: TObject);
  begin
    TStyleManager.SetStyle(TMyStyleWithNoIndicator.Create);
  end;
相关问题