Forum | | | | Erasmus.Herold | Hallöchen ...
I using subesquent Ansatz, circa type and Size To to determine.
hFont& = create("Font", "Arial",14,0,0,0,0)
setdialogfont hFont&
create("text", fenster_darueber%, "Hallöchen ...", 115, 310, 150, 18)
How can I The Textfarbe on a of me chosen RGB worth settle? unfortunately none suitable Ansatz found.
Greeting Erasmus |
| | | | |
| | Georg Teles | Hello, look time in the Help
'-Begin-----------------------------------------------------------------
'-HeaderFiles---------------------------------------------------------
$H windows.ph
$H Messages.ph
'-Variables Declaration-----------------------------------------------
Declare end%, OldWndProc&, hButton%
Declare hText1%, TextBk1&, hText2%, TextBk2&, hText3%, TextBk3&
'-CallBack routine----------------------------------------------------
Proc ColorText
Parameters hWnd&, Message&, wParam&, lParam&
If Message& = ~WM_CTLCOLORSTATIC
'-Fuer Text1 colour settle---------------------------------------
If lParam& = hText1%
~SetBkMode(wParam&, ~TRANSPARENT)
~SetTextColor(wParam&, @RGB($FF, $00, $00))'-ruddy-----------
Return TextBk1&
'-Fuer Text2 colour settle---------------------------------------
ElseIf lParam& = hText2%
~SetBkMode(wParam&, ~TRANSPARENT)
~SetTextColor(wParam&, @RGB($00, $00, $FF))'-blue----------
Return TextBk2&
'-Fuer Text3 colour settle---------------------------------------
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 determine---------------------------------------
TextBk1& = ~CreateSolidBrush(@RGB($00, $FF, $FF))'-Cyan----------
TextBk2& = ~CreateSolidBrush(@RGB($FF, $FF, $00))'-yellow----------
TextBk3& = ~CreateSolidBrush(@RGB($FF, $00, $FF))'-Magenta-------
'-Erweitertes MessageHandling turn off----------------------------
Set("FastMode", 1)
'-Window oeffnen---------------------------------------------------
Window 0, 0 - 640, 480
'-ProgramMainRoutine with CallBack redirecting on Own---------------
OldWndProc& = ~GetWindowLong(%hWnd, ~GWL_WNDPROC)
~SetWindowLong(%hWnd, ~GWL_WNDPROC, @ProcAddr("ColorText", 4))
'-GUI set up------------------------------------------------------
hButton% = @Create("Button", %hWnd, "Ende", 10, 10, 100, 24)
'-Textfields------------------------------------------------------
hText1% = @Create("Text", %hWnd, " Colored Text1", 10, 50, \
110, 18)
hText2% = @Create("Text", %hWnd, " Colored Text2", 10, 70, \
110, 18)
hText3% = @Create("Text", %hWnd, " Colored Text3", 10, 90, \
110, 18)
'-dialog-Loop---------------------------------------------------
Clear end%
WhileNot end%
WaitInput
If %Key = 2
end% = 1
ElseIf @Clicked(hButton%)
end% = 1
EndIf
EndWhile
'-Fuellmuster enable---------------------------------------------
~DeleteObject(TextBk1&)
~DeleteObject(TextBk2&)
~DeleteObject(TextBk3&)
'-Urspruengliche ProgramMainRoutine again produce---------------
~SetWindowLong(%hWnd, ~GWL_WNDPROC, OldWndProc&)
'-End-------------------------------------------------------------------
End
alternatively can You The SKControl.dll of Sebastian using
Regards |
| | | | |
| | p.specht
| i'm evident To simply knitted: Why not simply UseFont and Text Color? |
| | | XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 08/21/19 ▲ |
| |
| | Erasmus.Herold | @Georg - so one Monster only for colour? |
| | | | |
| | Georg Teles | Nunja, windows power the simply so here The kürzere Variante
$H windows.ph
$H Messages.ph
Declare end%, OldWndProc&, Text1&, Text2&, Text3&, BG&
Proc ColorText
Parameters hWnd&, Message&, wParam&, lParam&
If Message& = ~WM_CTLCOLORSTATIC
If (lParam& = Text1&) | (lParam& = Text2&) | (lParam& = Text3&)
'but not SetBKMode + Return can following row alternatively uses go
'~SetBkColor(wParam&, RGB($00, $00, $00))
~SetBkMode(wParam&, ~TRANSPARENT)
~SetTextColor(wParam&, RGB($FF, $00, $00))
Return BG&'for Backgroundcolor
'Return 0 'for transparency
EndIf
Else
Return ~CallWindowProc(OldWndProc&, hWnd&, Message&, wParam&, lParam&)
EndIf
ENDPROC
' Backgroundcolor = green
BG& = ~CreateSolidBrush(RGB($00,$FF,$00))
Set("FastMode", 1)
Window 0, 0 - 640, 480
OldWndProc& = ~GetWindowLong(%hWnd, ~GWL_WNDPROC)
~SetWindowLong(%hWnd, ~GWL_WNDPROC, @ProcAddr("ColorText", 4))
Text1& = @Create("Text", %hWnd, " Colored Text1", 10, 50, 110, 18)
Text2& = @Create("Text", %hWnd, " Colored Text2", 10, 70, 110, 18)
Text3& = @Create("Text", %hWnd, " Colored Text3", 10, 90, 110, 18)
Clear end%
WhileNot end%
WaitInput
If %Key = 2
end% = 1
EndIf
EndWhile
~DeleteObject(BG&)
~SetWindowLong(%hWnd, ~GWL_WNDPROC, OldWndProc&)
End
Regards |
| | | | |
| | p.specht
| Hallöchen ...
I use subesquent Ansatz, circa type and Size To to determine:
Cls
UseFont "ARIAL",14,8,0,0,0
Text Color Rgb(255,0,0),Rgb(100,255,100)
DrawText 10,100," Colored Text1 "
Text Color Rgb(0,0,255),Rgb(100,255,255)
DrawText 10,120," Colored Text2 "
Text Color Rgb(0,25,0),Rgb(250,0,250)
DrawText 10,140," Colored Text3 "
WaitInput
around the colour in the Nachhinein To Change, write I drüber. naively, works but. |
| | | Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 10/21/20 ▲ |
| |
|
AnswerThemeninformationenthis Topic has 3 subscriber: |