下面我們將上面提供的一段代碼作如下修改
j:=FDataLink
I:=
repeat
items
//在items屬性中加入DisplayName的值
I:=I+
until I>j-
另外
var
I
begin
j:=FDataLink
for I :=
begin
if FDataLink
begin
Result:=FDataLink
exit;
end;
end;
end;
這樣
程序中的字段以中文顯示能夠給用戶帶來很大的方便
interface
uses
Windows
StdCtrls
type
TDBFieldComboBox = class(TComboBox)
private
FDataLink:TFieldDataLink;
function GetDataSource:TDataSource;
function TListBox
Procedure SetDataSource( Value:TDataSource);
procedure StartDrag(Sender: Tobject; var DragObject: TDragObject);
procedure DropDown(Sender : Tobject);
{ Private declarations }
protected
{ Protected declarations }
public
constructor create(Aowner:Tcomponent);override;
destructor Destroy;override;
{ Public declarations }
published
property DataSource :TDataSource read GetDataSource write SetDataSource;
property text;
{ Published declarations }
end;
[
From:http://tw.wingwit.com/Article/program/Delphi/201311/8536.html