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 XP Manifest und eigene Paint-Procedure (https://www.delphipraxis.net/78145-xp-manifest-und-eigene-paint-procedure.html)

oki 29. Sep 2006 17:53


XP Manifest und eigene Paint-Procedure
 
Hi Leute,

ich habe für das XP-style den ThemeManager mit einer Manifest-Datei eingebunden. Das klappt auch super.

Jetzt muß ich aber feststellen, dass meine Komponenten in denen ich im canvas zeichne nichts mehr zu sehen ist.

Bsp:
Delphi-Quellcode:
  TCustomRegler = class(TCustomPanel)
  private
    FReglerName : String;         // Reglertyp (P, PI, PD ...)
    FInnerRect : TRect;
  protected
...
    Procedure DrawPanel; virtual;
    procedure DrawHeaderPanel;
    procedure DrawBottomPanel; virtual;
    procedure DrawPanelFrame;
    procedure DrawName;
    procedure DrawFunctionLine; virtual; abstract;
    procedure Paint; override;
    procedure createWnd; override;
  public
    constructor Create(AOwner: TComponent); override;
  published
...


procedure TCustomRegler.Paint;
begin
  inherited;
  DrawPanel;
end;

...

procedure TCustomRegler.DrawPanel;
begin
  UpdateInnerRect;
  DrawPanelFrame;
  IF (self.Height > 60) then begin
    DrawHeaderPanel;
    DrawBottomPanel;
    DrawName;
  end;
  DrawFunctionLine;
end;

...

procedure TCustomRegler.DrawHeaderPanel;
var r : TRect;
    oColor : TColor;
begin
  r := rect(1, 1, self.width - 1, 16);
  oColor := canvas.Brush.Color;
  canvas.Brush.Color := clwhite;
  canvas.FillRect(r);
  canvas.Brush.Color := oColor;
  oColor := canvas.Pen.Color;
  canvas.Pen.Color := clblack;
  canvas.MoveTo(1, 16);
  canvas.LineTo(self.Width - 1, 16);
  canvas.Pen.Color := oColor;
end;
Das ist mal ein einfaches Beispiel. die Frage für mich ist jetzt, warum werden unter XP mit XP-Style meine Malereien nicht mehr gezeichnet?

Gruß und Dank oki

Muetze1 29. Sep 2006 18:02

Re: XP Manifest und eigene Paint-Procedure
 
Leite nicht von einem Panel ab sondern entweder von TGraphicControl oder ein TWinControl Nachfahre. Das TCustomPanel ist die Basis für ein Panel und da lässt die VCL dann komplett vom ThemeManager zeichnen - da kommt deine Routine gar nicht mehr zum Zuge...

oki 29. Sep 2006 18:08

Re: XP Manifest und eigene Paint-Procedure
 
Hi Muetze,

ich check das mal, ob ich so einfach zu einer anderen Basiskompo springen kann. Dann würde ich aber lieber TcustomControl nehmen. Die hat dann schon mal einen Canvas :wink:

am liebsten würde ich aber TCustomPanel bleiben, wenn es einen anderen Weg gibt das Problem zu umgehen.

gruß oki

oki 4. Okt 2006 08:14

Re: XP Manifest und eigene Paint-Procedure
 
Hi,

ich habe jetzt die Kompos nicht von TCustomPanel, sondern von TcustomControl abgeleitet. Der Aufwand war definitiv gering und unter XP wird jetzt auch wieder alles sauber gezeichnet.

gruß oki


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:39 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