Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi "Rahmen" innerhalb einer Combobox (https://www.delphipraxis.net/55222-rahmen-innerhalb-einer-combobox.html)

stonimahoni 18. Okt 2005 10:11


"Rahmen" innerhalb einer Combobox
 
Moin Leute...


total banale Frage denke ich, aber :

Ich habe z.B. ne Combobox auf meinem Formular und würde dies gern "einfärben".
Allerdings nicht komplett - also über combobox1.color := .... z.b.

Sondern ich würde gern ne Art Rahmen um das geschriebene haben. Ne Umrahmung innerhalb der Box wenn Ihr versteht was ich meine ?!

Habt Ihr da ne Idee ? ich hab sonst nix gefunden diesbzgl :(



Danke schonmal


MFG

Carsten

Niko 18. Okt 2005 20:50

Re: "Rahmen" innerhalb einer Combobox
 
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;


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:15 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz