dfm 布局文件中的
去掉dgtitles 设置为false dgindicator 为False 即可隐藏标题栏
datasource中的Dataset 可以使用 TMemTableEH 控件 作为数据源,里面定义好字段与数据
这种的就是写死在程序中不需要连接数据库
列内容 居中显示
DBGridEh1.ColumnDefValues.Layout :=tlCenter;
列显示行线的设置不显示设置为False
DBGridEh1.GridLineParams.DataHorzLines :=False;
DBGridEh1.GridLineParams.DataVertLines :=False;
//搜索行显示在DBGridEh1 下面 显示上一行,下一行DBGridEh1.HorzScrollBar.ExtraPanel.Visible 的这个属性
if DBGridEh1.SearchPanel.Location = splGridTopEh then
begin
DBGridEh1.SearchPanel.Location := splHorzScrollBarExtraPanelEh;
DBGridEh1.HorzScrollBar.ExtraPanel.Visible := True;
Button6.Caption := 'FilterPanel in the Top (No)';
end else
begin
DBGridEh1.SearchPanel.Location := splGridTopEh;
DBGridEh1.HorzScrollBar.ExtraPanel.Visible := False;
Button6.Caption := 'FilterPanel in the Top (Yes)';
end;
object DBGridEh1: TDBGridEh
Left = 5
Top = 29
Width = 137
Height = 429
Align = alLeft
AutoFitColWidths = True
Border.Color = clBtnShadow
Border.EdgeBorders = [ebRight]
Color = clBtnFace
ColumnDefValues.Layout = tlCenter
Ctl3D = True
DataSource = DataSource1
DynProps = <>
Flat = True
IndicatorOptions = []
Options = [dgColumnResize, dgRowLines, dgTabs, dgAlwaysShowSelection, dgConfirmDelete, dgCancelOnExit]
ParentCtl3D = False
ReadOnly = True
RowHeight = 2
RowLines = 2
TabOrder = 2
VertScrollBar.SmoothStep = True
Columns = <
item
CellButtons = <>
DynProps = <>
EditButtons = <>
FieldName = 'MenuName'
Footers = <>
Width = 149
end>
object RowDetailData: TRowDetailPanelControlEh
end
end