Registriert seit: 23. Jun 2003
416 Beiträge
Delphi 2006 Professional
|
Re: "Rahmen" innerhalb einer Combobox
18. Okt 2005, 21:50
Hi,
das geht, indem du die Eigenschaft Style deiner ComboBox auf csOwnerDrawFixed setzt und den Inhalt selber zeichnest.
Etwa so:
Delphi-Quellcode:
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
ComboBox1.Canvas.Pen.Color := clRed;
ComboBox1.Canvas.Rectangle(Rect);
Rect.Left := Rect.Left + 1;
Rect.Top := Rect.Top + 1;
Rect.Right := Rect.Right - 1;
Rect.Bottom := Rect.Bottom - 1;
ComboBox1.Canvas.Brush.Style := bsClear;
ComboBox1.Canvas.TextRect(Rect, Rect.Left, Rect.Top, ComboBox1.Items[Index]);
end;
"Electricity is actually made up of extremely tiny particles called electrons, that you cannot see with the naked eye unless you have been drinking." (Dave Barry)
|