Damit das mit dem einblenden und ausblenden der Form ein wenig schoener aussieht, kannst du ja auch noch AnimateWindow nutzen.
VB.NET-Quellcode
- Imports System.Runtime.InteropServices
- Public Class Form1
- <DllImport("user32.dll")> _
- Shared Function AnimateWindow(ByVal hwnd As IntPtr, ByVal time As Integer, ByVal flags As AnimateWindowFlags) As Boolean
- End Function
- <Flags()> _
- Public Enum AnimateWindowFlags
- AW_HOR_POSITIVE = &H1
- AW_HOR_NEGATIVE = &H2
- AW_VER_POSITIVE = &H4
- AW_VER_NEGATIVE = &H8
- AW_CENTER = &H10
- AW_HIDE = &H10000
- AW_ACTIVATE = &H20000
- AW_SLIDE = &H40000
- AW_BLEND = &H80000
- End Enum
- Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
- AnimateWindow(Handle, 1000, AnimateWindowFlags.AW_HIDE Or AnimateWindowFlags.AW_BLEND)
- End Sub
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- AnimateWindow(Handle, 1000, AnimateWindowFlags.AW_BLEND)
- End Sub
- End Class
And i think to myself... what a wonderfuL World!