AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Arbeit mit Units

Ein Thema von foerster7892 · begonnen am 14. Jun 2009 · letzter Beitrag vom 14. Jun 2009
Antwort Antwort
Seite 2 von 2     12   
Popov
(Gast)

n/a Beiträge
 
#11

Re: Arbeit mit Units

  Alt 14. Jun 2009, 11:31
Was aber ohne Probleme geht ist das:

Unit1:

Delphi-Quellcode:
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
begin
  MyDrawListBox(Control, Index, Rect, State);
end;
Unit2:

Delphi-Quellcode:
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;
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.
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 2 von 2     12   


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:23 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