| |
|
|
| KompilierenMarkierenSeparierenSource wurde am 15.07.2007 aus der MMJ-Quellcodesammlung (Dietmar Horn) in die Babyklappe auf XProfan.Com abgelegt:
Textfeld: Vorder- und Hintergrundfarbe von Textfeldern festlegen
-Begin-----------------------------------------------------------------
-HeaderFiles---------------------------------------------------------
$H Windows.ph
$H Messages.ph
-Variables Declaration-----------------------------------------------
Declare Ende%, OldWndProc&, hButton%
Declare hText1%, TextBk1&, hText2%, TextBk2&, hText3%, TextBk3&
-CallBack Routine----------------------------------------------------
Proc ColorText
Parameters hWnd&, Message&, wParam&, lParam&
If Message& = ~WM_CTLCOLORSTATIC
-Fuer Text1 Farbe setzen---------------------------------------
If lParam& = hText1%
~SetBkMode(wParam&, ~TRANSPARENT)
~SetTextColor(wParam&, @RGB($FF, $00, $00)) -Rot-----------
Return TextBk1&
-Fuer Text2 Farbe setzen---------------------------------------
ElseIf lParam& = hText2%
~SetBkMode(wParam&, ~TRANSPARENT)
~SetTextColor(wParam&, @RGB($00, $00, $FF)) -Blau----------
Return TextBk2&
-Fuer Text3 Farbe setzen---------------------------------------
ElseIf lParam& = hText3%
~SetBkMode(wParam&, ~TRANSPARENT)
~SetTextColor(wParam&, @RGB($00, $FF, $00)) -Gruen---------
Return TextBk3&
EndIf
Else
Return ~CallWindowProc(OldWndProc&, hWnd&, Message&,
wParam&, lParam&)
EndIf
EndProc
-Main----------------------------------------------------------------
-Hintergrundfarben festlegen---------------------------------------
TextBk1& = ~CreateSolidBrush(@RGB($00, $FF, $FF)) -Cyan----------
TextBk2& = ~CreateSolidBrush(@RGB($FF, $FF, $00)) -Gelb----------
TextBk3& = ~CreateSolidBrush(@RGB($FF, $00, $FF)) -Magenta-------
-Erweitertes MessageHandling abschalten----------------------------
Set(FastMode, 1)
-Fenster oeffnen---------------------------------------------------
Window 0, 0 - 640, 480
-ProgramMainRoutine mit CallBack umleiten auf eigene---------------
OldWndProc& = ~GetWindowLong(%hWnd, ~GWL_WNDPROC)
~SetWindowLong(%hWnd, ~GWL_WNDPROC, @ProcAddr(ColorText, 4))
-GUI aufbauen------------------------------------------------------
hButton% = @Create(Button, %hWnd, Ende, 10, 10, 100, 24)
-Textfelder------------------------------------------------------
hText1% = @Create(Text, %hWnd, Farbiger Text1, 10, 50,
110, 18)
hText2% = @Create(Text, %hWnd, Farbiger Text2, 10, 70,
110, 18)
hText3% = @Create(Text, %hWnd, Farbiger Text3, 10, 90,
110, 18)
-Dialog-Schleife---------------------------------------------------
Clear Ende%
WhileNot Ende%
WaitInput
If %Key = 2
Ende% = 1
ElseIf @Clicked(hButton%)
Ende% = 1
EndIf
EndWhile
-Fuellmuster freigeben---------------------------------------------
~DeleteObject(TextBk1&)
~DeleteObject(TextBk2&)
~DeleteObject(TextBk3&)
-Urspruengliche ProgramMainRoutine wieder herstellen---------------
~SetWindowLong(%hWnd, ~GWL_WNDPROC, OldWndProc&)
-End-------------------------------------------------------------------
End
|
|
|
| |
|
|