gpt4 book ai didi

C# Winforms : can't create window using system. 窗口

转载 作者:行者123 更新时间:2023-12-04 17:06:35 26 4
gpt4 key购买 nike

这个问题和this one差不多,但我在任何地方都找不到合适的答案。
基本上,我正在尝试创建一个新窗口来显示用户控件,但它不起作用,它显示一个错误,指出找不到类型或命名空间“Window”。我已实现 using System.Windows; .
代码如下所示:

private void settB_Click(object sender, EventArgs e)
{
Window window = new Window
{
Title = "My User Control Dialog",
Content = new qlSetting(),
ResizeMode = ResizeMode.NoResize
};
window.ShowDialog();
}

最佳答案

private void settB_Click(object sender, EventArgs e)
{
using (Form window = new Form())
{
qlSetting ql = new qlSetting();
ql.Dock = DockStyle.Fill;
window.Controls.Add(ql);
window.ShowDialog();
}
}

关于C# Winforms : can't create window using system. 窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53052918/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com