euroman28 & ulrina ---> Duer ikke! Jeg kikker efter en funktion der gør at når formen bliver under en hvis højde og brede kan man simpelthen ikke gøre den midre - som om den ikke var sizable. Den kode I begge har foreslået gør at formen flakker og flimre og i øvrigt godt kan blive mindre end man sætter 'MinHøjde' og 'MinBredde' til... Håber I forstår hvad jeg mener
'Add to Form Private Sub Form_Load() Call StartResize(Me) End Sub
Private Sub Form_Unload(Cancel As Integer) Call StopResize(Me) End Sub
'Add to Module Private Const GWL_WNDPROC As Long = -4 Private Const WM_GETMINMAXINFO As Long = &H24 Private Const SM_CXFULLSCREEN As Long = 16 Private Const SM_CYFULLSCREEN As Long = 17 Private Const SM_CYCAPTION As Long = 4
Type POINTAPI x As Long y As Long End Type
Type MINMAXINFO ptReserved As POINTAPI ptMaxSize As POINTAPI ptMaxPosition As POINTAPI ptMinTrackSize As POINTAPI ptMaxTrackSize As POINTAPI End Type
Private mlngOldWindowProc&
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As Any, pSource As Any, ByVal ByteLen As Long) Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Function SubClass1_WndMessage(ByVal hWnd As Long, ByVal Msg As Long, ByVal wp As Long, ByVal lp As Long) As Long If Msg = WM_GETMINMAXINFO Then
SubClass1_WndMessage = CallWindowProc(mlngOldWindowProc, hWnd, Msg, wp, lp) End Function
Public Sub StartResize(ByVal Form As Form) mlngOldWindowProc& = GetWindowLong&(Form.hWnd, GWL_WNDPROC) Call SetWindowLong&(Form.hWnd&, GWL_WNDPROC, AddressOf SubClass1_WndMessage) End Sub
Public Sub StopResize(ByVal Form As Form) Call SetWindowLong&(Form.hWnd&, GWL_WNDPROC, mlngOldWindowProc&) End Sub
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.