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 FontDialog & ColorDialog (https://www.delphipraxis.net/26010-fontdialog-colordialog.html)

Doctor 16. Jul 2004 12:49


FontDialog & ColorDialog
 
Hallo

Ich möchte gerne über ein Menu die Schriftfarbe und Schriftart des Panels ändern, auf dem ich einige Edits und Panals untergebracht habe.
Ich hab da mal n bischen getestet und die Delphi-Hilfe bringt mich net wirklich weiter.

aus der Delphi Hilfe:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);

begin
   TFontDialog1.Options = TFontDialog1.Options + fdApplyButton;
   TFontDialog1.Execute;

end;

procedure TForm1.FontDialog1Apply(Sender: TObject; Wnd: Integer);

begin
  if ActiveControl is TEdit then
    with ActiveControl as TEdit do
       Font.Assign(TFontDialog(Sender).Font)
  else if ActiveControl is TRichEdit then
    with ActiveControl as TRichEdit do
      SelAttributes.Assign(TFontDialog(Sender).Font)
  else
    Beep;

end;
Teilweise versteh ich das ja, aber es klappt net so, wie ich das will ... ausserdem hab ich keine Ahnung, wie ich das mit dem ColorDialog machen soll.

Kann mir da jemand helfen ?
MfG
Doctor

Steve 18. Jul 2004 13:24

Re: FontDialog & ColorDialog
 
Delphi-Quellcode:
{ Font auswählen }
procedure TForm1.SelFontClick(Sender: TObject);
begin
  if fontDlg.Execute then
  begin
    Label1.Font.Assign(FontDialog1.Font);
  end;
end;

{ Farbe auswählen }
procedure TForm1.SelColorClick(Sender: TObject);
begin
  if colorDlg.Execute then
  begin
    Label1.Font.Color := colorDlg.Color;
  end;
end;
Wobei im TFontDialog auch schon einige Schriftfarben zur Auswahl stehen.

Gruß
Stephan

Doctor 18. Jul 2004 15:24

Re: FontDialog & ColorDialog
 
klar kann man die farben schon im font dialog auswählen.
der colordialog ist ja für den hintergrund des programms gedacht

trotzdem mal danke
mfg
doc


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