⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 overdeff.pas

📁 外国人写的各种类型的源代码,有兴趣的朋友看看吧!是学习的好东西哟
💻 PAS
字号:
unit OverDefF;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    Button6: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure Test;
begin
  Beep;
end;

// error overload missing in Test (previous version)
{procedure Test (I: integer); overload;
begin
  Beep;
end;}

procedure ShowMsg (str: string); overload;
begin
  MessageDlg (str, mtInformation, [mbOK], 0);
end;

procedure ShowMsg (FormatStr: string;
  Params: array of const); overload;
begin
  MessageDlg (Format (FormatStr, Params),
    mtInformation, [mbOK], 0);
end;

procedure ShowMsg (I: Integer; Str: string); overload;
begin
  ShowMsg (IntToStr (I) + ' ' + Str);
end;

// error: ambiguous call
{procedure ShowMsg (Str: string; I: Integer = 0); overload;
begin
  MessageDlg (Str + ': ' + IntToStr (I),
    mtInformation, [mbOK], 0);
end;}

procedure MessageDlg (str: string); overload;
begin
  Dialogs.MessageDlg (str, mtInformation, [mbOK], 0);
end;

procedure MessBox (Msg: string;
  Caption: string = 'Warning';
  Flags: LongInt = mb_OK or mb_IconHand);
begin
  Application.MessageBox (PChar (Msg),
    PChar (Caption), Flags);
end;

// TForm1 //

procedure TForm1.Button1Click(Sender: TObject);
begin
  OverDefF.MessageDlg ('Hello');
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  ShowMsg ('Hello');
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  ShowMsg (10, 'MBytes');
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  ShowMsg ('Total = %d.', [100]);
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
  MessBox ('Something wrong here!');
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
  MessBox ('Something wrong here!', 'Attention');
  // doens't compile
  // MessBox ('Hello', mb_OK);
end;

end.








⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -