Die nachfolgenden Prozeduren zeigen ein paar nette Effekte zum Einblenden (Implode) und Ausblenden (Explode) von Fenstern. ' Zunächst alle benötigten API-Funktionen Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Declare Function GetWindowRect Lib "user32" ( _ ByVal hwnd As Long, _ lpRect As RECT) As Long Private Declare Function GetDC Lib "user32" ( _ ByVal hwnd As Long) As Long Private Declare Function ReleaseDC Lib "user32" ( _ ByVal hwnd As Long, _ ByVal hdc As Long) As Long Private Declare Function SetBkColor Lib "gdi32" ( _ ByVal hdc As Long, _ ByVal crColor As Long) As Long Private Declare Function Rectangle Lib "gdi32" ( _ ByVal hdc As Long, _ ByVal X1 As Long, _ ByVal Y1 As Long, _ ByVal X2 As Long, _ ByVal Y2 As Long) As Long Private Declare Function CreateSolidBrush Lib "gdi32" ( _ ByVal crColor As Long) As Long Private Declare Function SelectObject Lib "user32" ( _ ByVal hdc As Long, _ ByVal hObject As Long) As Long Private Declare Function DeleteObject Lib "gdi32" ( _ ByVal hObject As Long) As Long ' Ausblenden-Effekt Public Sub ExplodeForm(f As Form, Speed As Integer) Dim R As RECT Dim fWidth As Integer Dim fHeight As Integer Dim i As Integer Dim x As Integer Dim y As Integer Dim cx As Integer Dim cy As Integer Dim Desktop As Long Dim Brush As Long GetWindowRect f.hwnd, R fWidth = (R.Right - R.Left) fHeight = R.Bottom - R.Top Desktop = GetDC(0) Brush = CreateSolidBrush(f.BackColor) For i = 1 To Speed cx = fWidth * (i / Speed) cy = fHeight * (i / Speed) x = R.Left + (fWidth - Cx) / 2 y = R.Top + (fHeight - Cy) / 2 Rectangle Desktop, x, y, x + cx, y + cy Next i x = ReleaseDC(0, Desktop) DeleteObject (Brush) End Sub ' Einblenden-Effekt Public Sub ImplodeForm(f As Form, Speed As Integer) Dim R As RECT Dim fWidth As Integer Dim fHeight As Integer Dim i As Integer Dim x As Integer Dim y As Integer Dim cx As Integer Dim cy As Integer Dim Desktop As Long Dim Brush As Long GetWindowRect f.hwnd, R fWidth = (R.Right - R.Left) fHeight = R.Bottom - R.Top Desktop = GetDC(0) Brush = CreateSolidBrush(f.BackColor) For i = Speed To 1 Step -1 cx = fWidth * (i / Speed) cy = fHeight * (i / Speed) x = R.Left + (fWidth - Cx) / 2 y = R.Top + (fHeight - Cy) / 2 Rectangle Desktop, x, y, x + cx, y + cy Next i x = ReleaseDC(0, Desktop) DeleteObject (Brush) End Sub Beispiel: Private Sub Form_QueryUnload() ImplodeForm Me, 500 End Sub Private Sub Form_Unload() ExplodeForm Me, 500 End End Sub Dieser Tipp wurde bereits 24.602 mal aufgerufen.
Anzeige
![]() ![]() ![]() (einschl. Beispielprojekt!) Ein absolutes Muss - Geballtes Wissen aus mehr als 8 Jahren vb@rchiv! - nahezu alle Tipps & Tricks und Workshops mit Beispielprojekten - Symbol-Galerie mit mehr als 3.200 Icons im modernen Look Weitere Infos - 4 Entwickler-Vollversionen (u.a. sevFTP für .NET), Online-Update-Funktion u.v.m. |
vb@rchiv CD Vol.6 ![]() ![]() Geballtes Wissen aus mehr als 8 Jahren vb@rchiv! Online-Update-Funktion Entwickler-Vollversionen u.v.m. Tipp des Monats sevOutBar 4.0 ![]() Vertikale Menüleisten á la Outlook Erstellen von Outlook ähnlichen Benutzer- interfaces - mit beliebig vielen Gruppen und Symboleinträgen. Moderner OfficeXP-Style mit Farbverläufen, Balloon-Tips, u.v.m. |
||||||||||||||||
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein. |