![]() |
Re: Digital-Anzeige
Zitat:
ich wollte nämlich aus dem 1.Beitrag TZiffer.SetBounds (...) aufrufen und dies ging nicht! //EDIT: man kann auch auf dei UnterPanels verzichten, wenn man in Paint direkt zeichnet, beim ändern muss man nur Self.Invalidate aufrufen! |
Re: Digital-Anzeige
Zitat:
|
Re: Digital-Anzeige
so
Delphi-Quellcode:
unit unitZiffer;
interface uses Classes, Graphics, ExtCtrls; type {-- Range --} TValueRange = 0..9; {-- Class: --} TCustomZiffer = class (TCustomPanel) constructor Create (AOwner: TComponent); override; private FNumerus: TValueRange; FBarColor: TColor; FFrameColor: TColor; procedure SetNumerus(const Value: TValueRange); procedure SetBarColor(const Value: TColor); procedure SetFrameColor(const Value: TColor); protected procedure Paint; override; property Numerus: TValueRange read FNumerus write SetNumerus; property BarColor: TColor read FBarColor write SetBarColor; property FrameColor: TColor read FFrameColor write SetFrameColor; public end; {-- Class: --} TZiffer= class (TCustomZiffer) public published property Numerus; property BarColor; property FrameColor; // hier kann man weitere Eigenschaften, die man benötigt freigeben end; implementation { TCustomZiffer } constructor TCustomZiffer.Create(AOwner: TComponent); begin inherited; FNumerus := 0; FBarColor := clRed; FFrameColor := clYellow; Width := 65; Height := 105; end; procedure TCustomZiffer.Paint; const coBars: array[TValueRange] of Byte = ($7E,$18,$6D,$3D,$1B, $37,$77,$1C,$7F,$3F); coPos: array[0..6,0..3] of Integer = ((9,33,48,16),(33,9,16,8),(9,33,8,16), (33,9,16,48),(33,9,56,48),(9,33,88,16),(33,9,56,8)); var I,B: Byte; begin inherited; B := 1; Canvas.Brush.Color := FBarColor; Canvas.Pen.Color := FFrameColor; for I := 0 to 6 do begin if (B and coBars[FNumerus])>0 then begin Canvas.Rectangle(coPos[I][3],coPos[I][2], coPos[I][3]+coPos[I][1], coPos[I][2]+coPos[I][0]); end; B := B shl 1; end; end; procedure TCustomZiffer.SetBarColor(const Value: TColor); begin if Value<>FBarColor then begin FBarColor := Value; Invalidate; end; end; procedure TCustomZiffer.SetFrameColor(const Value: TColor); begin if FFrameColor<>Value then begin FFrameColor := Value; Invalidate; end; end; procedure TCustomZiffer.SetNumerus(const Value: TValueRange); begin if Value<>FNumerus then begin FNumerus := Value; Invalidate; end; end; end. |
Re: Digital-Anzeige
Zitat:
|
Re: Digital-Anzeige
Das obendrein....
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 16: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-2025 by Thomas Breitkreuz