如何使用Windows Forms C#创建不可见的表单
问题描述:
这可能是一个愚蠢的问题,但我无法做到。
打开EXE时我打开两个表格。
我需要让一张表格永远隐形。
我尝试过
This may be a silly question but I am unable to do it.
I am opening two forms when opening an EXE.
I need to make one form always invisible.
I tried
this.visble=false;
它没用。
然后我尝试了
it didn't work.
I then tried
this.Hide();
它隐藏了我的要求,但是当我打开EXE时它会闪烁一次然后隐藏。
我也试过
It hides my required from but when I open that EXE it blinks once then it hides.
I also tried
this.Visible = false;
this.WindowState = FormWindowState.Minimized;
this.ShowInTaskbar = false;
如何永久隐藏而不显示屏幕上的闪烁
How to permanently hide without showing even a blinking in the screen
答
有你试过Opacity属性?
have you tried Opacity property ?
void Form1_Load(object sender, EventArgs e)
{
this.Opacity = 0.0;
}
public Form1()
{
InitializeComponent();
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.ShowInTaskbar = false;
this.Load += new EventHandler(Form1_Load);
}
void Form1_Load(object sender, EventArgs e)
{
this.Size = new Size(0, 0);
}