淡入表格 [英] Fade-In Form

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

问题描述

嘿伙计我试图使用以下代码淡化表单:


公共类frmAbout

继承System.Windows.Forms.Form


Dim i As Integer''公共变量


#Region Windows窗体代码......

私有子Timer1_Tick(ByVal sender As System.Object,ByVal e As

System.EventArgs)处理Timer1.Tick

如果i< 100然后

i = i + 1

Me.Opacity = i / 100

否则

Timer1.Stop( )

结束如果

结束次级

结束班级


我尝试将我的计时器调整为各种值(当前为500000,因为我是
不确定这个数字对应的是什么)我的计时器是在我的

表单初始化代码中启动的。然而我的表格并没有消失,它有点眨眼,而且只是出现了。在我创建表单的函数中:


Dim objAbout = new frmAbout()

objAbout.MdiParent = Me

objAbout.Show()


关于为什么我的表单没有淡入的任何想法?

(在设计视图的属性窗口中,不透明度设置为0

表格)


-Ivan


***通过Developersdex发送 http://www.developersdex.com ***

不要只是参与在USENET ...获得奖励!

Hey guys I am trying to fade in a form using the following code:

Public Class frmAbout
Inherits System.Windows.Forms.Form

Dim i As Integer ''Public Variable

#Region The Windows Form code...
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
If i < 100 Then
i = i + 1
Me.Opacity = i / 100
Else
Timer1.Stop()
End If
End Sub
End Class

I tried adjusting my timer to various values (currently 500000 as I am
not sure what this number corresponds to) and my timer is started in my
form initialization code. Yet my form does not fade in, it kinda blinks
and just appears. In the function that creates the form I have:

Dim objAbout = New frmAbout()
objAbout.MdiParent = Me
objAbout.Show()

Any ideas on why my form is not fading in?
(THe opacity is set to 0 in the properties window in design view of the
form)

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!

推荐答案

Ivan:


我有一篇文章这里
http://www.knowdotnet.com/testsite /a...s/opacity.html 。它在C#中,但是它需要帮助。
应该有所帮助。顺便说一句,我们仍在校对语法,但代码是正确的。
正确。 HTH,

比尔

" Ivan Weiss" < 4 ***** @ optonline.net>在消息中写道

新闻:************** @ TK2MSFTNGP11.phx.gbl ...
Ivan:

I have an article over here
http://www.knowdotnet.com/testsite/a...s/opacity.html . It''s in C# but it
should help. BTW, we are still proofing the grammar, but the code is
correct. HTH,

Bill
"Ivan Weiss" <iv*****@optonline.net> wrote in message
news:Of**************@TK2MSFTNGP11.phx.gbl...
嘿伙计们我正在尝试使用以下代码淡入表单:

Public Class frmAbout
Inherits System.Windows.Forms.Form

Dim i As Integer''Public Variable

#Region Windows窗体代码......

Private Sub Timer1_Tick(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理Timer1.Tick
如果我< 100然后
i = i + 1
Me.Opacity = i / 100
否则
Timer1.Stop()
结束如果
End Sub
我尝试将我的计时器调整为各种值(目前为500000,因为我不确定这个数字对应的是什么),我的计时器以我的
形式启动初始化代码。然而我的形式并没有消失,有点眨眼,只是出现了。在创建表单的函数中我有:

Dim objAbout = new frmAbout()
objAbout.MdiParent = Me
objAbout.Show()
关于为什么我的表单没有消失的任何想法?
(在
表单的设计视图中的属性窗口中将不透明度设置为0)

-Ivan

***通过开发人员指南 http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!
Hey guys I am trying to fade in a form using the following code:

Public Class frmAbout
Inherits System.Windows.Forms.Form

Dim i As Integer ''Public Variable

#Region The Windows Form code...
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
If i < 100 Then
i = i + 1
Me.Opacity = i / 100
Else
Timer1.Stop()
End If
End Sub
End Class

I tried adjusting my timer to various values (currently 500000 as I am
not sure what this number corresponds to) and my timer is started in my
form initialization code. Yet my form does not fade in, it kinda blinks
and just appears. In the function that creates the form I have:

Dim objAbout = New frmAbout()
objAbout.MdiParent = Me
objAbout.Show()

Any ideas on why my form is not fading in?
(THe opacity is set to 0 in the properties window in design view of the
form)

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!



Ivan:


此外,您可能希望将睡眠增量降低到70甚至50

,具体取决于您的机器工作的速度/速度,但这可以明确地做到这一点

没有闪烁。


HTH,


Bill

" Ivan Weiss" < 4 ***** @ optonline.net>在消息中写道

新闻:************** @ TK2MSFTNGP11.phx.gbl ...
Ivan:

Also, you may want to move the Sleep increment down to 70 or even 50
depending on how fast/slow your machine works, but this can defintiely do it
without flicker.

HTH,

Bill
"Ivan Weiss" <iv*****@optonline.net> wrote in message
news:Of**************@TK2MSFTNGP11.phx.gbl...
嘿伙计们我正在尝试使用以下代码淡入表单:

Public Class frmAbout
Inherits System.Windows.Forms.Form

Dim i As Integer''Public Variable

#Region Windows窗体代码......

Private Sub Timer1_Tick(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理Timer1.Tick
如果我< 100然后
i = i + 1
Me.Opacity = i / 100
否则
Timer1.Stop()
结束如果
End Sub
我尝试将我的计时器调整为各种值(目前为500000,因为我不确定这个数字对应的是什么),我的计时器以我的
形式启动初始化代码。然而我的形式并没有消失,有点眨眼,只是出现了。在创建表单的函数中我有:

Dim objAbout = new frmAbout()
objAbout.MdiParent = Me
objAbout.Show()
关于为什么我的表单没有消失的任何想法?
(在
表单的设计视图中的属性窗口中将不透明度设置为0)

-Ivan

***通过开发人员指南
http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!
Hey guys I am trying to fade in a form using the following code:

Public Class frmAbout
Inherits System.Windows.Forms.Form

Dim i As Integer ''Public Variable

#Region The Windows Form code...
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
If i < 100 Then
i = i + 1
Me.Opacity = i / 100
Else
Timer1.Stop()
End If
End Sub
End Class

I tried adjusting my timer to various values (currently 500000 as I am
not sure what this number corresponds to) and my timer is started in my
form initialization code. Yet my form does not fade in, it kinda blinks
and just appears. In the function that creates the form I have:

Dim objAbout = New frmAbout()
objAbout.MdiParent = Me
objAbout.Show()

Any ideas on why my form is not fading in?
(THe opacity is set to 0 in the properties window in design view of the
form)

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!



我尝试将此代码插入我的form_load并删除我的其他代码

利用计时器:


Dim i As Double = 0.0


For i = 0.0至i> = 1.0

Me.Opacity = i

i = i + 0.1

System.Threading.Thread.Sleep(500 )

下一页

Me.Opacity = 1


然而,它做同样的事情。它有点犹豫,而且只是

出现,没有消失。


-Ivan


***通过开发人员指南
http://www.developersdex.com 发送***

不要只是参加USENET ......获得奖励!
I tried inserting this code into my form_load and removing my other code
utilizing the timer:

Dim i As Double = 0.0

For i = 0.0 To i >= 1.0
Me.Opacity = i
i = i + 0.1
System.Threading.Thread.Sleep(500)
Next
Me.Opacity = 1

However, it does the same thing. It kind of hesitates and than just
shows up, there is no fade in.

-Ivan

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


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

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