Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# winforms中的messagebox内部下拉/选择_C#_Winforms_Messagebox - Fatal编程技术网

C# winforms中的messagebox内部下拉/选择

C# winforms中的messagebox内部下拉/选择,c#,winforms,messagebox,C#,Winforms,Messagebox,我想在我的msgbox中的c#中有一个下拉/选择项。像这个 但要选择颜色主题 我试过以下方法 string[] items = {"Black", "White", "Red", "Green", "Blue"}; string msg = "Select one color theme you like to have active", items; string title = "Select color theme"; messagebox buttons = MessageBoxButt

我想在我的msgbox中的c#中有一个下拉/选择项。像这个

但要选择颜色主题

我试过以下方法

string[] items = {"Black", "White", "Red", "Green", "Blue"};
string msg = "Select one color theme you like to have active", items;
string title = "Select color theme";
messagebox buttons = MessageBoxButtons.YesNo;
DialogResult result;
result = MessageBox.Show(msg, title, buttons);

但它不起作用。你知道这个问题的解决方法吗?

MessageBox是一个foraign类,你不能在其中添加额外的控件。你必须自己建立控制

var form = new Form(); // or control how you like
var dropDown = new ComboBox();
// some dropdown settings ....
string[] installs = new string[]{"Typical", "Compact", "Custom"};
dropDown .Items.AddRange(installs);
form.Controls.Add(dropDown)

// start/show the control
form.Show();

MessageBox是一个foraign类,您不能在其中添加其他控件。你必须自己建立控制

var form = new Form(); // or control how you like
var dropDown = new ComboBox();
// some dropdown settings ....
string[] installs = new string[]{"Typical", "Compact", "Custom"};
dropDown .Items.AddRange(installs);
form.Controls.Add(dropDown)

// start/show the control
form.Show();

最简单的方法是创建一个自定义表单,然后使用.ShowDialog()

最简单的方法是创建一个自定义表单,然后使用.ShowDialog()

哦,现在我明白了我搞砸了什么,非常简单。谢谢你解释得这么清楚:)谢谢!哦,现在我明白我把事情搞砸了,很简单。谢谢你解释得这么清楚:)谢谢!我懂了。。谢谢你帮我,谢谢你。但下一次(如果你知道怎么做,想要并且能够)试着更清楚地解释:)我明白了,没有仇恨。。谢谢你帮我,谢谢你。但下一次(如果你知道怎么做,想要并且能够)试着更清楚地解释:)不要仇恨,泰