| |
|
|
|
Source watts on the 15.07.2007 from the MMJ-Quellcodesammlung (Dietmar horn) in The Babyklappe on XProfan.Com stored:
Resize of Steuerelementen in Echtzeit
in the subesquent example becomes The Resize one Steuerelementes,
in this drop one Button, in Echtzeit demonstrating. with Veränderung the Size the Fensters
changed itself too The Size the Buttons.
-Begin-----------------------------------------------------------------
-HeaderFiles---------------------------------------------------------
$H windows.ph
$H Messages.ph
-Variables Declaration-----------------------------------------------
Declare end%, OldWndProc&, hButton%
-CallBack routine----------------------------------------------------
Proc ChangeControl
Parameters hWnd&, Message&, wParam&, lParam&
Declare btnHeight&
If Message& = ~WM_SIZE
-request, so Button not small 16 Pixel Hoehe------------
If @Height(%hWnd) / 5 < 16
btnHeight& = 16
Else
btnHeight& = @Height(%hWnd) / 5
EndIf
-Groesse the Buttons Change-----------------------------------
SetWindowPos hButton%, 10, 34 - @Width(%hWnd) - 20, btnHeight&
EndIf
Return ~CallWindowProc(OldWndProc&, hWnd&, Message&,
wParam&, lParam&)
ENDPROC
-Main----------------------------------------------------------------
-Erweitertes MessageHandling turn off----------------------------
Set(FastMode, 1)
-Window oeffnen and GUI set up----------------------------------
Window 0, 0 - 640, 480
Window Title Resize of Steuerelementen in Echtzeit
-Backgroundcolor the Fensters set---------------------------
Declare Color&, Red%, Green%, Blue%
Color& = ~GetSysColor(~COLOR_3DFACE)
Red% = @GetRValue(Color&)
Green% = @GetGValue(Color&)
Blue% = @GetBValue(Color&)
Cls @RGB(Red%, Green%, Blue%)
-----------------------------------------------------------------
@Create(Text, %hWnd, Ändere The Size this Fensters, 10,
10, 250, 20)
hButton% = @Create(Button, %hWnd, end, 10, 34,
@Width(%hWnd) - 20, @Height(%hWnd) / 5)
-ProgramMainRoutine with CallBack redirecting on Own---------------
OldWndProc& = ~GetWindowLong(%hWnd, ~GWL_WNDPROC)
~SetWindowLong(%hWnd, ~GWL_WNDPROC, @ProcAddr(ChangeControl, 4))
-dialog-Loop---------------------------------------------------
Clear end%
WhileNot end%
WaitInput
If %Key = 2
end% = 1
ElseIf @Clicked(hButton%)
end% = 1
EndIf
EndWhile
-Urspruengliche ProgramMainRoutine again produce---------------
~SetWindowLong(%hWnd, ~GWL_WNDPROC, OldWndProc&)
-End-------------------------------------------------------------------
End
|
|
|
| |
|
|