Name Value Pairs in a ComboBox

后端 未结 4 1599
醉话见心
醉话见心 2021-02-01 06:42

I\'m convinced this must be a common problem, but I can\'t seem to find a simple solution...

I want to use a combobox control with name value pairs as the items. ComboBo

4条回答
  •  执笔经年
    2021-02-01 07:04

    Set Style to csOwnerDrawFixed and write

    procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
      Rect: TRect; State: TOwnerDrawState);
    begin
      ComboBox1.Canvas.TextRect(Rect, Rect.Left, Rect.Top, ComboBox1.Items.Names[Index]);
    end;
    

提交回复
热议问题