小弟刚刚开始接触Delphi,现在在进行练习中,我做一个简单的WinForm的对话框设计中碰到问题。
程序有两个简单的窗体WinForm,WinForm1。其中WinForm1被命名为AboutBox,且FormBorderStyle属性为FixedDialog,ControlBox,MinimizeBox和MaxmizeBox属性都是False。主窗体WinForm通过点击一个菜单项来调用显示WinForm1,可是在运行时主窗体的程序中老是出现不能识别AboutBox的错误,这是为什么啊??是否是主窗体在调用WinForm1的时候要在程序段中加以编写或者用uses之类的??请各位帮帮忙,我之前的练习也有过类似的毛病。
一下是两个窗体中的额部分程序段,请各位帮我看看吧。谢谢!!
蓝色字体处为报错点:undeclared identified:'AboutBox'
主窗体 WinForm:
unit WinForm;
interface
uses
System.Drawing, System.Collections, System.ComponentModel,
System.Windows.Forms, System.Data;
type
TWinForm = class(System.Windows.Forms.Form)
{$REGION 'Designer Managed Code'}
strict private
/// <summary>
/// Required designer variable.
/// </summary>
Components: System.ComponentModel.Container;
MainMenu1: System.Windows.Forms.MainMenu;
mnu_About: System.Windows.Forms.MenuItem;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
procedure InitializeComponent;
procedure mnu_About_Click(sender: System.Object; e: System.EventArgs);
{$ENDREGION}
strict protected
/// <summary>
/// Clean up any resources being used.
/// </summary>
procedure Dispose(Disposing: Boolean); override;
private
{ Private Declarations }
public
constructor Create;
end;
............
............
procedure TWinForm.mnu_About_Click(sender: System.Object; e: System.EventArgs);
var
box : AboutBox;
begin
box := AboutBox.Create;
box.ShowDialog;
end;
子窗体 WinForm1:
unit WinForm1;
interface
uses
System.Drawing, System.Collections, System.ComponentModel,
System.Windows.Forms, System.Data;
type
AboutBox = class(System.Windows.Forms.Form)
{$REGION 'Designer Managed Code'}
strict private
/// <summary>
/// Required designer variable.
/// </summary>
Components: System.ComponentModel.Container;
Label1: System.Windows.Forms.Label;
Button1: System.Windows.Forms.Button;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
procedure InitializeComponent;
procedure Button1_Click(sender: System.Object; e: System.EventArgs);
{$ENDREGION}
strict protected
/// <summary>
/// Clean up any resources being used.
/// </summary>
procedure Dispose(Disposing: Boolean); override;
private
{ Private Declarations }
public
constructor Create;
end;