C# WinForms:在新表单加载时选择选项卡可见性
在应用程序中加载文件时,我无法设置选项卡的可见性。 当用户启动应用程序时,它会显示欢迎选项卡,我想做的是当用户选择文件 -> 时打开它可以很好地在新的编辑器表单中加载文件,但我似乎无法弄清楚如何使其加载表单并设置编辑器选项卡的可见性。
if (this.openEditorDialog.ShowDialog(this) == DialogResult.OK && editForm != null)
{
editForm.Close();
editForm = new EditorForm(this);
editForm.OpenFile(this.openEditorDialog.FileName);
editForm.Closing += new CancelEventHandler(EditorForm_Closing);
editForm.Show();
}
我尝试过 editForm.EditorTab.Show();以及 Activecontrol = editForm.EditorTab 无济于事。非常感谢。
I'm having trouble with setting the visibility of a tab when a file is loaded in my application.
When a user launches the app it displays the welcome tab, what I'm trying to do is when a user selects file -> open it loads the file in a new editor form fine but I can't seem to figure out how to make it load the form and also set the visibility of the editor tab.
if (this.openEditorDialog.ShowDialog(this) == DialogResult.OK && editForm != null)
{
editForm.Close();
editForm = new EditorForm(this);
editForm.OpenFile(this.openEditorDialog.FileName);
editForm.Closing += new CancelEventHandler(EditorForm_Closing);
editForm.Show();
}
I've tried doing editForm.EditorTab.Show(); as well as Activecontrol = editForm.EditorTab to no avail. Many thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
TabControl 有一个
SelectedTab
属性: 查看 MSDN 来了解这一点。我知道我有一个样本,只需找到它即可。...哎呀,它是
SelectTab
:MSDN 上The TabControl has a
SelectedTab
property: check MSDN for that. I know I have a sample, just need to find it....oops, it is
SelectTab
: here on MSDN在 form.show 命令之后执行以下操作:
After your form.show command do the following: