Tscreen 클래스 - 프로그램의 창 개수

1208 단어
//           ,         :
program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit2.pas' {Form2};

{$R *.res}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.Run;
end.

 
 
 
 
 

 

 
  

//
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses Unit2;

procedure TForm1.Button1Click(Sender: TObject);
var
  num: Integer;
begin
  num := Screen.FormCount;    {          }
  ShowMessage(IntToStr(num)); {2}

  Screen.Forms[1].ShowModal;  {       }
  {       }
  //Form2.ShowModal;
end;

end.

 
 
 
 
 

 

 
  

좋은 웹페이지 즐겨찾기