Autor Beitrag
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Fr 10.03.06 11:33 
Hallo Leute !
Ich wollte mittels Panel einen Button nachbilden der die Farbe beim Überfahren mit der Maus ändert.
Das funktioniert auch Problemlos bis Ich das XP Manifest aufziehe dann ist's aus.
Hatt jemand von euch eine Ahnung woran das liegen könnte oder wie man das eventuell auch anders hinkriegt ?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure TForm1.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  Panel1.Color:=clWhite;
end;

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  Panel1.Color:=clBtnFace;
end;

procedure TForm1.FormPaint(Sender: TObject);
begin
  Canvas.Pen.Width:=1;
  Canvas.Pen.Color:=clBlack;
  Canvas.Rectangle(Panel1.Left-1,Panel1.Top-1,
  Panel1.Left+Panel1.Width+1,Panel1.Top+Panel1.Height+1);
end;
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Fr 10.03.06 11:38 
Der Sinn des XP-Manifests ist es ja, dass die Standard-Elemente so gezeichnet werden, wie es das System vorgibt. Da das Panel damit auch so gezeichnet wird, verlieren deine Methoden die Wirkung.

_________________
We are, we were and will not be.
Blackheart666 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Fr 10.03.06 11:43 
OK Danke ! Da kann man wohl nix Machen.
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Fr 10.03.06 12:11 
pack doch einfach n shape ins panel
espen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 90
Erhaltene Danke: 1


D6 Prof./D7 Prof. MSSQL, MySQL
BeitragVerfasst: Fr 10.03.06 13:42 
Hi,

einen kleinen Trick gibt es da aber.
Ergänze Deinen Code mal mit folgendem:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
procedure TForm1.FormCreate(Sender: TObject);
begin
  SetXPPanelColor();
end;

procedure TForm1.SetXPPanelColor();
var
  I : Integer;
begin
  // ****
  // **** Farbe aller Panels eines Forms setzen
  // ****
  for I := Form1.ComponentCount - 1 downto 0 do
  begin
    if (Form1.Components[I] is TPanel) then
    begin
      with Form1.Components[I] as TPanel do
      begin
        ParentBackground := False;
        ParentBackground := True;
        ParentBackground := False;
      end;
    end;
  end;
end;
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Fr 10.03.06 13:47 
Das funzt echt ^^ der XP-Style des Panels verschwindet dann aber ;)
Blackheart666 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Fr 10.03.06 14:04 
Danke espen das war genau das was Ich gesucht hab !

user profile iconF34r0fTh3D4rk hat folgendes geschrieben:
Das funzt echt ^^ der XP-Style des Panels verschwindet dann aber ;)

Das war auch der Sinn der Sache.