启动隐藏的表单 [英] Starting A form hidden

查看:55
本文介绍了启动隐藏的表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁可以告诉我为什么不开始隐藏?


公共类Form1

继承System.Windows.Forms.Form

Public Sub New()

MyBase.New()

InitializeComponent()

End Sub

受保护的重载覆盖子处理(ByVal处理为布尔值)

如果处置则

如果不是(组件什么都没有)那么

组件。处理()

结束如果

结束如果

MyBase.Dispose(处置)

End Sub

私有组件As System.ComponentModel.IContainer

Private Sub InitializeComponent()

Me.AutoScaleBaseSize = New System.Drawing.Size(5,13)

Me.ClientSize = New System.Drawing.Size(292,273)

Me.Name =" Form1"

Me.Text = Form1

结束子

公共共享子主体()

将myForm调暗为新Form1

myForm .Visible = False

System.Windows.Forms.App lication.Run(myForm)

返回

结束次级

结束班级

Can anyone tell me why this doesn''t start hidden?

Public Class Form1
Inherits System.Windows.Forms.Form
Public Sub New()
MyBase.New()
InitializeComponent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
Private components As System.ComponentModel.IContainer
Private Sub InitializeComponent()
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Name = "Form1"
Me.Text = "Form1"
End Sub
Public Shared Sub Main()
Dim myForm As New Form1
myForm.Visible = False
System.Windows.Forms.Application.Run(myForm)
Return
End Sub
End Class

推荐答案

表单本身的windowstate是什么。你为什么要隐藏它来开始



" AJPlonka" < AJ ****** @ discussions.microsoft.com>在消息中写道

新闻:96 ********************************** @ microsof t.com ...
What is the windowstate on the form itself. Why would you want to start
with it hidden?
"AJPlonka" <AJ******@discussions.microsoft.com> wrote in message
news:96**********************************@microsof t.com...
任何人都可以告诉我为什么这不会被隐藏起来吗?

公共类Form1
继承System.Windows.Forms.Form
Public Sub New()
MyBase.New()
InitializeComponent()
End Sub
受保护的重载覆盖Sub Dispose(ByVal disposing As Boolean)
如果处理则
如果不是(组件什么都没有)那么
components.Dispose()
结束如果
结束如果
MyBase.Dispose(处置)
End Sub
私有组件As System.ComponentModel.IContainer
Private Sub InitializeComponent()
Me.AutoScaleBaseSize = New System.Drawing.Size(5,13)
Me.ClientSize = New System.Drawing.Size(292,273)
Me.Name =" Form1"
Me.Text =" Form1"
End Sub
Public Shared Sub Main( )
将myForm变暗为新Form1
myForm.Visible = False
System.Windows.Forms.Application .Run(myForm)
返回
End Sub
End Class
Can anyone tell me why this doesn''t start hidden?

Public Class Form1
Inherits System.Windows.Forms.Form
Public Sub New()
MyBase.New()
InitializeComponent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
Private components As System.ComponentModel.IContainer
Private Sub InitializeComponent()
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Name = "Form1"
Me.Text = "Form1"
End Sub
Public Shared Sub Main()
Dim myForm As New Form1
myForm.Visible = False
System.Windows.Forms.Application.Run(myForm)
Return
End Sub
End Class



" AJPlonka" < AJ ****** @ discussions.microsoft.com> schrieb
"AJPlonka" <AJ******@discussions.microsoft.com> schrieb
谁能告诉我为什么这不会被隐藏?
[...]
System.Windows.Forms.Application.Run(myForm)


运行显示表格。没有显示它是没有意义的,因为只要表格关闭,这个

重载版本的Run就会返回,因此

它会立即返回。如果你不想从一个初创公司

表格开始,请使用Application.Run()。但是你什么时候打算出示这个表格?

没有用户界面,用户可以显示它。该应用程序将在

后台运行而不做任何事情。除非你有一个NotifyIcon或一个

计时器。

返回


这个回报是没有必要的

End Sub
Can anyone tell me why this doesn''t start hidden?
[...]
System.Windows.Forms.Application.Run(myForm)
Run shows the Form. It wouldn''t make sense not to show it because this
overloaded version of Run returns as soon as the Form is closed, therefore
it would return immediatelly. If you don''t want to start with a startup
form, use Application.Run(). But when do you intend to show the form? There
is no user interface enabling the user to show it. The app would run in the
background without doing anything. Unless you''ve got a NotifyIcon or a
Timer.
Return
This return is not necessary
End Sub



Armin


Armin


您始终可以将表单不透明度设置为0。 />

Dim Form1作为新Form1

Form1.opacity = 0

Form1.Show()


我在我写的生物识别时钟应用程序中使用它。


当你显示表单时,你所要做的就是将不透明度带回

100,你甚至可以用一个循环让它淡入。

You could always set the forms opacity to 0.

Dim Form1 As New Form1
Form1.opacity = 0
Form1.Show()

I use this in a biometric timeclock app I wrote.

When you show the form all you have to do is bring the opacity back to
100, you can even use a loop to make it fade-in.


这篇关于启动隐藏的表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆