;Autor: edel, STARGÅTE ;http://www.purebasic.fr/german/viewtopic.php?p=330767#p330767 Procedure WinCallback(hWnd, uMsg, wParam, lParam) Protected *rc.rect Protected Length.i Static ARatio1.f = 0 Static ARatio2.f = 0 If uMsg = #WM_SIZING *rc = lParam If ARatio1 = 0 ARatio1 = (*rc\right - *rc\left) / (*rc\bottom - *rc\top) ARatio2 = (*rc\bottom - *rc\top) / (*rc\right - *rc\left) EndIf Select wParam Case #WMSZ_BOTTOM, #WMSZ_TOP Length = (*rc\right - *rc\left) *rc\right + ((*rc\bottom - *rc\top) * ARatio1 - Length)/2 *rc\left - ((*rc\bottom - *rc\top) * ARatio1 - Length)/2 Case #WMSZ_LEFT, #WMSZ_RIGHT Length = (*rc\bottom - *rc\top) *rc\bottom + ((*rc\right - *rc\left) * ARatio2 - Length)/2 *rc\top - ((*rc\right - *rc\left) * ARatio2 - Length)/2 Case #WMSZ_BOTTOMLEFT, #WMSZ_BOTTOMRIGHT *rc\bottom = (*rc\right - *rc\left) * ARatio2 + *rc\top Case #WMSZ_TOPLEFT, #WMSZ_TOPRIGHT *rc\top = -(*rc\right - *rc\left) * ARatio2 + *rc\bottom EndSelect EndIf ProcedureReturn #PB_ProcessPureBasicEvents EndProcedure OpenWindow(0, 0, 0, 800, 400, "Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget) SetWindowCallback(@WinCallback()) Repeat Select WaitWindowEvent() Case #PB_Event_CloseWindow End EndSelect ForEver ; IDE Options = PureBasic 5.31 (Windows - x64) ; CursorPosition = 2 ; Folding = - ; EnableUnicode ; EnableXP ; EnableUser ; EnableCompileCount = 0 ; EnableBuildCount = 0