Autor Beitrag
maniax
Hält's aus hier
Beiträge: 6



BeitragVerfasst: Mi 18.08.10 20:38 
Moin alle zusammen

ich stehe irgendwie auf'm Schlauch
Ich erzeuge zur Laufzeit (ButtonClick) mehrere panels
diese möchte ich gerne in der Farbe verändern aber irgendwie geht das nicht

bin für alle Ideen dankbar


Moderiert von user profile iconNarses: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Mi 18.08.2010 um 21:09
Einloggen, um Attachments anzusehen!
platzwart
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1054
Erhaltene Danke: 78

Win 7, Ubuntu 9.10
Delphi 2007 Pro, C++, Qt
BeitragVerfasst: Mi 18.08.10 20:43 
Einfach ein Color:= ClYellow; hinzufügen...

_________________
Wissenschaft schafft Wissenschaft, denn Wissenschaft ist Wissenschaft, die mit Wissen und Schaffen Wissen schafft. (myself)
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Mi 18.08.10 20:43 
Hi und :welcome: im Forum!

user profile iconmaniax hat folgendes geschrieben Zum zitierten Posting springen:
diese möchte ich gerne in der Farbe verändern aber irgendwie geht das nicht

"Geht irgendwie nicht" ist keine korrekte Fehlerbeschreibung. Was genau funktioniert nicht?

Du kannst Code hier direkt via Delphi-Tags [delphi]Code[/delphi] posten. :)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
 begin
        with TCustomPanel.Create(Form2) do
          begin
            SetBounds(iStartLinks, iPosStartOben, iEd7, iEd8);
            Parent := Self; // Probier's mal mit Parent := Form2;
            iStartLinks := iStartLinks + iEd7 + iEd11;
            iStartPosObenHilf := iPosStartOben + iEd8 + iEd12;
          end;
      end;

Die Eigenschaft Color hat user profile iconplatzwart ja bereits genannt.
maniax Threadstarter
Hält's aus hier
Beiträge: 6



BeitragVerfasst: Mi 18.08.10 21:01 
ich habe das mit color getestet
auf die Idee bin ich aber auch schon gekommen

nur das Resultat ist das dann alles die Farbe ändert nur meine Panels nicht

Fehlermeldungen gibt es keine ich bekomme es nur nicht hin die einzufärben
platzwart
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1054
Erhaltene Danke: 78

Win 7, Ubuntu 9.10
Delphi 2007 Pro, C++, Qt
BeitragVerfasst: Mi 18.08.10 21:04 
Hängt wohl damit zusammen, dass du das böse with-Konstrukt benutzt...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
myCustomPanel: TCustomPanel;
[...]

myCustomPanel:= TCustomPanel(Form2)Create;
myCustomPanel.SetBounds(iStartLinks, iPosStartOben, iEd7, iEd8);
myCustomPanel.iStartLinks := iStartLinks + iEd7 + iEd11;
myCustomPanel.iStartPosObenHilf := iPosStartOben + iEd8 + iEd12;
myCustomPanel.Color:= ClYellow;

_________________
Wissenschaft schafft Wissenschaft, denn Wissenschaft ist Wissenschaft, die mit Wissen und Schaffen Wissen schafft. (myself)
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Mi 18.08.10 21:41 
user profile iconplatzwart hat folgendes geschrieben Zum zitierten Posting springen:
Hängt wohl damit zusammen, dass du das böse with-Konstrukt benutzt...
Nope.

ausblenden Delphi-Quelltext
1:
2:
  Panel1.ParentBackground := False;
  Panel1.Color := clRed;

So sollte es aber gehen. :idea: :zwinker:

DOH hat folgendes geschrieben:
If ParentBackground is true, the control uses the parent's theme background to draw its own background. ParentBackground has no effect unless XP themes are enabled.

When XP themes are enabled ParentBackground defaults to true. To use the Color property to determine the background color of a control, set ParentBackground to false. This is done automatically if the Color property is changed at designtime.
maniax Threadstarter
Hält's aus hier
Beiträge: 6



BeitragVerfasst: Do 19.08.10 08:45 
moin moin

erstmal danke

ich habe die with Geschichte rausgeschmissen
und das mit myPanel versucht

das klappte zuerst auch nicht

aber nach Panel.ParentBackground wurde alles gut

Danke danke