Хочу анимировать сворачивание окна в трей, использую следующий код Const IDANI_OPEN = &H1 Const IDANI_CLOSE = &H2 Const IDANI_CAPTION = &H3 Private Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long Private Declare Function DrawAnimatedRects Lib "user32" (ByVal hwnd As Long, ByVal idAni As Long, lprcFrom As RECT, lprcTo As RECT) As Long Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Dim rSource As RECT, rDest As RECT, ScreenWidth As Long, ScreenHeight As Long Private Sub Form_Resize()
If Me.WindowState = vbMinimized Then ScreenWidth = Screen.Width / Screen.TwipsPerPixelX ScreenHeight = Screen.Height / Screen.TwipsPerPixelY SetRect rDest, ScreenWidth, ScreenHeight, ScreenWidth, ScreenHeight SetRect rSource, Me.Left / Screen.TwipsPerPixelX, Me.Top / Screen.TwipsPerPixelY, Me.Left / Screen.TwipsPerPixelX, Me.Top / Screen.TwipsPerPixelY DrawAnimatedRects Me.hwnd, IDANI_CLOSE Or IDANI_CAPTION, rSource, rDest End If End Sub Я думаю что я ошибаюсь когда задаю координаты rSource но не могу найти ошибку.Подскажите пожалуйста где я не прав.
Ответить
|