Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- ComboBox1.Clear;
- ComboBox1.Style := csOwnerDrawFixed;
- ComboBox1.Items.Add('cmd_estart=Entry start');
- ComboBox1.Items.Add('cmd_eend=Entry End');
- end;
- procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
- begin
- TComboBox(Control).Canvas.FillRect(Rect);
- if Index >= 0 then
- TComboBox(Control).Canvas.TextOut(Rect.Left + 2, Rect.Top, TComboBox(Control).Items.ValueFromIndex[Index]);
- end;
- procedure TForm1.Button1Click(Sender: TObject);
- var
- ItemCommand: string;
- ItemCaption: string;
- begin
- ItemCommand := ComboBox1.Items.Names[ComboBox1.ItemIndex];
- ItemCaption := ComboBox1.Items.ValueFromIndex[ComboBox1.ItemIndex];
- ShowMessage(Format('Command: %s; Caption: %s', [ItemCommand, ItemCaption]));
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement