English
Forum

Create Text in others colours

 

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
 
08/21/19  
 




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
 
XProfan X2
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

08/21/19  
 




p.specht

i'm evident To simply knitted:
Why not simply UseFont and Text Color?
 
XProfan 11
Computer: 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?
 
08/21/19  
 




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
 
XProfan X2
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

08/21/19  
 




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  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

5.510 Views

Untitledvor 0 min.
Sven Bader11/22/23
Hans Neff01/19/23
H.Brill11/22/22
Rc01/31/22
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie