在vb.net上动画Windows窗体 [英] animate windows form on vb.net

查看:323
本文介绍了在vb.net上动画Windows窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好.
动画的借口示例单击表单
感谢Abbasi.

Hello.
Excuse example of the animation click on form
Thanks Abbasi.

推荐答案

您最好的选择是使用WPF.否则,您需要使用一个计时器,并在计时器的每个滴答声中将表单对象移到您想要的位置.
Your best bet is to use WPF. Otherwse, you need to use a timer and every tick of the timer, move your form object closer to where you want it to be.


私人button1作为Button
私有组件作为IContainer = Nothing
专用tm作为计时器=新计时器

私有子Form1_Load(ByVal发送者作为对象,ByVal e作为EventArgs)
MyBase.Left =(Screen.PrimaryScreen.WorkingArea.Width-MyBase.Width)
MyBase.Top =(Screen.PrimaryScreen.WorkingArea.Height-MyBase.Height)
Me.tm.Enabled = False
Me.tm.Interval = 20
AddHandler Me.tm.Tick,函数
如果(MyBase.Width< 500)然后
Form1.MoveWindow(MyBase.Handle,(MyBase.Left-5),(MyBase.Top-5),(MyBase.Width + 5),(MyBase.Height + 5),True)
其他
Me.tm.Enabled = False
如果结束
最终功能
结束子

< dllimport("user32.dll",> _
朋友共享函数MoveWindow(ByVal hWnd为IntPtr,ByVal X为整数,ByVal Y为整数,ByVal nWidth为整数,ByVal nHeight为整数,ByVal bRepaint为布尔值)为布尔值
结束功能
Private button1 As Button
Private components As IContainer = Nothing
Private tm As Timer = New Timer

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
MyBase.Left = (Screen.PrimaryScreen.WorkingArea.Width - MyBase.Width)
MyBase.Top = (Screen.PrimaryScreen.WorkingArea.Height - MyBase.Height)
Me.tm.Enabled = False
Me.tm.Interval = 20
AddHandler Me.tm.Tick, Function
If (MyBase.Width < 500) Then
Form1.MoveWindow(MyBase.Handle, (MyBase.Left - 5), (MyBase.Top - 5), (MyBase.Width + 5), (MyBase.Height + 5), True)
Else
Me.tm.Enabled = False
End If
End Function
End Sub

<dllimport("user32.dll",> _
Friend Shared Function MoveWindow(ByVal hWnd As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal bRepaint As Boolean) As Boolean
End Function


这篇关于在vb.net上动画Windows窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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