Einzelnen Beitrag anzeigen

Muetze1
(Gast)

n/a Beiträge
 
#11

Re: Farbe von showmessage ändern

  Alt 14. Feb 2005, 18:00
Moin!

So schwer ist das doch nicht...

Delphi-Quellcode:
procedure CustomMessage(Text: string; FormColor, LabelColor: TColor);
var
  Messagelabel: TLabel;
  MessageButton: TButton;
  MessageForm : TForm;
begin
  MessageForm := TForm.Create(nil);
  Messagelabel := TLabel.Create(MessageForm);
  MessageButton := TButton.Create(MessageForm);

  with MessageForm do
   begin
    Color := FormColor;
    Caption := application.Title;
    SetBounds((Screen.Width - MessageForm.Width) div
     2, (Screen.Height - MessageForm.Height) div 2,MessageForm.Width,
      MessageForm.Height);
    BorderIcons := [biSystemMenu];
    BorderStyle := bsdialog;
    Height := 110;
   end;


  with Messagelabel do
   begin
    Caption := Text;
    Font.Color := LabelColor;
    Parent := MessageForm;
    Top := 15;
   end;

  with MessageButton do
   begin
    Caption := 'OK';
    Parent := MessageForm;
    Top := 40;
    ModalResult := mrOk;
    Default := True;
    Cancel := True;
   end;

  MessageForm.Width := 75 + MessageLabel.Width;
  MessageButton.Left := MessageForm.Width div 2 - Messagebutton.Width div 2;
  MessageLabel.Left := MessageForm.Width div 2 - MessageLabel.Width div 2;
  MessageForm.ShowModal;
  MessageForm.Free;
end;
Das ist alles.

MfG
Muetze1
  Mit Zitat antworten Zitat