如何让“关于”框出现在 C# 中?
我的 C# 项目中有一个名为 AboutBox1 的“关于”框,使用 Microsoft 的 Visual C# 2008 Express Edition。我已经让它在设计视图中看起来像我想要的那样,但是当单击“帮助”菜单中的“关于”链接时如何使其显示?
此代码使“关于”框出现,但它看起来是空白的。这不是我设计的。
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
AboutBox1 box = new AboutBox1();
box.ShowDialog();
}
任何想法或建议将不胜感激。谢谢。
I have an About box in my C# project using Microsoft's Visual C# 2008 Express Edition named AboutBox1. I have made it look how I want it in the design view, but how do I make it appear when the About link in the Help menu is clicked?
This codes makes an About box appear, but it looks blank. It's not the one I designed.
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
AboutBox1 box = new AboutBox1();
box.ShowDialog();
}
Any thoughts or suggestions would be appreciated. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
知道了。
关于框已从项目的程序集属性中删除。
转到项目 -> “项目名称”属性 ->装配信息。
您在那里设置所有信息。
如果您尝试在属性资源管理器中设置信息,它将在运行时被该窗口中的内容覆盖。
干杯,
麦克风
Got it.
The about box is driven off of assembly properties for your project.
Go to Project -> 'ProjectName' Properties -> Assembly Information.
You set all of the information there.
If you try to set the information in the Property Explorer it will simply be over written at run time by what ever is in this window.
Cheers,
Mike
在我看来,这就像一个无聊的设计师界面……你点击保存并重建它了吗?也许关闭 IDE,重新打开它,然后检查您精心设计的表单是否仍然漂亮?
顺便说一句,当使用
ShowDialog
时,您还应该使用using
(因为当使用ShowDialog
显示时,它本身不会Dispose()
)代码>):It sounds to me like a borked designer surface... have you hit save and rebuilt it? Perhaps close the IDE, reopen it, and check that your carefully designed form is still pretty?
BTW, when using
ShowDialog
you should also useusing
(since it doesn'tDispose()
itself when shown withShowDialog
):您是否在 AboutBox - 表单的构造函数中删除了对“InitializeComponent”的方法调用?
您的构造函数至少应该如下所示:
其中 InitializeComponent 方法调用应该是构造函数中的第一行。
Did you remove the method-call to 'InitializeComponent' in the constructor of your AboutBox - form ?
Your constructor should at least look like this:
Where the InitializeComponent method call should be the first line in the constructor.
如果出现但为空,则问题出在 AboutBox1 中。向我们展示一些代码。
If it appears but is blank, the problem is in AboutBox1. Show us some of that code.
我之前遇到过同样的问题,但我通过删除
InitializeComponent();
下面的语句解决了它默认代码:
我的最终代码:
I faced same problem before but I solved it by removing the statements below the
InitializeComponent();
Default code:
My final code:
我找不到项目/项目名称/程序集属性。
但是注释掉
InitializeComponent();
之后的行对我有用。这就是我的外观:
如果您是像我一样的业余爱好者,要找到这些行,请单击项目资源管理器中的 AboutBox,然后点击
View Code
按钮<>
。I couldn't find the project / project name/ assembly properties.
But commenting out the lines after
InitializeComponent();
worked for me.This is how mine looks:
If you are an amateur like me, to find these lines, click the AboutBox in the project explorer, and hit the
View Code
button<>
.