c# - 有没有办法不显示 windows 窗体?
问题描述
有没有办法,比如说,抑制 InitializeComponent?我目前正在尝试制作一种选择你自己的冒险的东西,我想知道是否有可能阻止表单打开,因为我使用的是消息框而不是数千个表单。
解决方案
似乎您根本不想要一个表单,而是试图用消息框做所有事情。除了设计之外,您不需要表单来显示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");
}
}
}
推荐阅读
- c++ - 如何处理可能具有多种类型之一的 Rcpp::XPtr
- r - 有没有办法将我的数据可视化为 R 中的表格格式
- spring-cloud - 我如何知道项目里程碑何时发布(没有为里程碑设置日期)?
- powershell - 从 ISO 8601 持续时间获取 DateTime 对象
- python - 有什么办法可以解决“project=Project.objects.get(pk=pk)”
- java - 当我尝试从命令或 android studio 获取 SHA-1 编号时,它给了我一个错误
- java - 在 Spring Boot Cacheable 中从缓存中检索数据
- python-3.x - 如何在远程 XBee 设备上验证数据包的接收
- amazon-web-services - 如何在 Route53 上创建电子邮件子域?
- algorithm - 特定分配的遗传算法