因为TcxButtonEditProperties类可用的属性不多,没有多余的属性来保留字段名,考虑到其DisplayFormat属性用得少,可以用他来保留字段名unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, ADODB, StdCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid, cxButtonEdit;type TForm1 = class(TForm) Button1: TButton; ADOConnection1: TADOConnection; ADOQuery1: TADOQuery; DataSource1: TDataSource; procedure Button1Click(Sender: TObject); private FcxGrid:TcxGrid; FcxGridLevel:TcxGridLevel; FcxGridDBTableView:TcxGridDBTableView; FcxDBColumn:TcxGridDBColumn; procedure cxGrid1DBTableView1DBColumn1PropertiesButtonClick( Sender: TObject; AButtonIndex: Integer); public { Public declarations } end;var Form1: TForm1;implementationuses Unit2;{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);begin form2:=TForm2.Create(self); try FcxGrid:=TcxGrid.Create(self); FcxGrid.Parent:=form2; FcxGrid.Align:=alClient; FcxGridLevel:=FcxGrid.Levels.Add; FcxGridDBTableView:=TcxGridDBTableView.Create(self); FcxGridDBTableView.DataController.DataSource:=DataSource1; FcxGridLevel.GridView:=FcxGridDBTableView; FcxDBColumn:=FcxGridDBtableView.CreateColumn; FcxDBColumn.DataBinding.FieldName:='userid'; FcxDBColumn.PropertiesClass:=TcxButtonEditProperties; TcxButtonEditProperties(FcxDBColumn.Properties).OnButtonClick:= cxGrid1DBTableView1DBColumn1PropertiesButtonClick; TcxButtonEditProperties(FcxDBColumn.Properties).DisplayFormat:= FcxDBColumn.DataBinding.FieldName; form2.ShowModal; FcxDBColumn.Free; FcxGridDBTableView.Free; FcxGridLevel.Free; FcxGrid.Free; finally form2.Free; end;end;procedure TForm1.cxGrid1DBTableView1DBColumn1PropertiesButtonClick( Sender: TObject; AButtonIndex: Integer);begin showmessage(TcxButtonEditProperties(TcxButtonEdit(Sender).ActiveProperties).DisplayFormat);end;end.