2008-11-18 41 views

回答

3

嘗試TDBLookupComboBox。查看ListField,DataField和KeyField屬性。

+0

看[這裏](http://stackoverflow.com/a/24995039/2523663)爲例。 – 2014-09-18 19:46:26

2

您可以用數字('0,'1','2',...)填充TDBComboBox項目,但將DBComboBox1.Style設置爲csOwnerDrawFixed並編寫OnItemDraw事件。像這樣的:

procedure TForm1.DBComboBox1DrawItem(Control: TWinControl; Index: Integer; 
    Rect: TRect; State: TOwnerDrawState); 
begin 
    with (Sender as TDBComboBox).Canvas do 
    begin 
    FillRect(Rect); 
    TextRect(Rect, Rect.Left+1, Rect.Top+1, MyValueDescriptions[Index]); 
    end; 
end; 
相關問題