Private Declare Sub SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long Private Declare Function InflateRect Lib "user32" (lpRect As RECT, ByVal x As Long, ByVal y As Long) As Long Private Declare Function ScreenToClient Lib "user32.dll" (ByVal hWnd As Long, lpPoint As POINTAPI) As Long Private Type POINTAPI x As Long y As Long End Type Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Public Function InflateControl(ContainerHwnd As Long, hWnd As Long, x As Long, y As Long) Dim R As RECT GetWindowRect hWnd, R Dim Pt As POINTAPI Pt.x R.Left: Pt.y R.Top ScreenToClient ContainerHwnd, Pt R.Left Pt.x: R.Top Pt.y Pt.x R.Right: Pt.y R.Bottom ScreenToClient ContainerHwnd, Pt R.Right Pt.x: R.Bottom Pt.y InflateRect R, x, y SetWindowPos hWnd, 0, R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, 0& End Function Private Sub Form_Load() HScroll1.Max = 50 End Sub Private Sub HScroll1_Change() Static OldValue As Long InflateControl Me.hWnd, Command1.hWnd, HScroll1.Value - OldValue, HScroll1.Value - OldValue OldValue = HScroll1.Value End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question