有没有办法抑制InitializeComponent? 我目前正在尝试做一种“选择自己的冒险”的事情,我想知道是否有可能阻止表单的打开,因为我使用的是消息框而不是数千个表单。
答案 0 :(得分:2)
似乎您根本不需要表单,并且正在尝试使用消息框进行所有操作。除了设计之外,您不需要表单即可显示MessageBox
。您只需要引用System.Windows.Forms
。
例如:
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
static class Program
{
[STAThread]
static void Main()
{
// gut everything else from the Windows Forms Application template
MessageBox.Show("Hello World");
}
}
}