标题:[求助]Delphi中窗体调用的问题
只看楼主
jimzzq
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-5-4
 问题点数:0 回复次数:2 
[求助]Delphi中窗体调用的问题
小弟刚刚开始接触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;
搜索更多相关主题的帖子: Delphi 窗体 
2006-05-05 10:13
kelehaha5
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2006-3-15
得分:0 
你这贴的是什么码?~~~!!!

2006-05-05 10:31
小茶
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2006-2-27
得分:0 
检查一下你所添加的调用语句以及添加的位置是否正确,如果均正确,则点击运行后会有提示添加的语句,确定后再次运行就可以了。

语句为:aboutbox.show;
添加处:被调用窗体的菜单项点击处
2006-05-05 17:59



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-61936-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.054012 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved