As we know that delphi has many message box(s), like showmessage, messagedlg ect. By defult we get font message in black color with style regular.  All style message are in dialogs unit. so if we want to enhance we have to change this unit as we want.

for example like this picture :
delphionderdils
next…on

for the first time copy dialogs unit to our project/folder program

next..

  • open dialogs unit
  • to change font message we must change font of label message like this
  • search function CreateMessageDialog
  • at TMessageForm(Result).Message := TLabel.Create(Result); 
  •  change font color by add code Font.Color:=clred;
  • this example for delphi 7

 

function CreateMessageDialog(const Msg: string;
  DlgType: TMsgDlgType;
  Buttons: TMsgDlgButtons): TForm;
const
....
....
...
    TMessageForm(Result).Message := TLabel.Create(Result);
    with TMessageForm(Result).Message do
    begin
      Name := 'Message';
      Parent := Result;
      WordWrap := True;
      Caption := Msg;
      Font.Color:=clred;
      BoundsRect := TextRect;
      BiDiMode := Result.BiDiMode;
      ALeft := IconTextWidth - TextRect.Right + HorzMargin;
      if UseRightToLeftAlignment then
        ALeft := Result.ClientWidth - ALeft - Width;
      SetBounds(ALeft, VertMargin,
        TextRect.Right, TextRect.Bottom);
    end;

 

 

Next… on

How to change font button..?

 

 

Print Friendly