![]() |
Re: Arbeit mit Units
Was aber ohne Probleme geht ist das:
Unit1:
Delphi-Quellcode:
Unit2:
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState); begin MyDrawListBox(Control, Index, Rect, State); end;
Delphi-Quellcode:
Hier verbleibt die Prozedur in Unit1, aber der eigentliche Code wird in Unit2 ausgeführt. Die Prozedur in Unit1 dient somit lediglich dazu die zweite Prozedur aufzurufen.
procedure MyDrawListBox(Control: TWinControl; Index: Integer; Rect: TRect;
State: TOwnerDrawState); const Col1: array [Boolean] of TColor = (clSilver, clWindow); Col2: array [Boolean] of TColor = (clInactiveCaptionText, clWindowText); begin with (Control as TListbox) do begin if odSelected in State then Canvas.Font.Color := clCaptionText else begin Canvas.Brush.Color := Col1[Odd(Index)]; Canvas.Font.Color := Col2[(Control as TListbox).Enabled]; end; Canvas.TextRect(Rect, Rect.Left, Rect.Top, Items[Index]); end; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:17 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz