English
Source / code snippets

dialog dye background Subclassing - 2

 
Andreas Miethe

CompileMarkSeparation
'######################
'Header-Dateien
'######################
 $H Windows.ph
 $H Messages.ph
'######################
Windowstyle 543
 $H Windows.ph
Declare Ende&,Ende1&,Win02&
CLS ~GetSysColor(~Color_BTNFACE)
'Der Brush wird von Windows benutzt um den Dialoghintergrund zu zeichnen
Var Dialogpinsel& = ~Createsolidbrush($FFFF80)
Var Button& = CREATE("BUTTON",%hwnd,"Dialog öffnen",10,10,150,25)
WindowTitle "Test..."

Whilenot Ende&

    Waitinput

    If Clicked(Button&)

        win02&=CREATE("Dialog",%hwnd,"Dialog",(%MaxX/2-300),(%MaxY/2-250),600,500)
        'einmal die Farbe geben
        Startpaint win02&
        cls $FFFF80
        Endpaint
        'Subclassing einschalten
        SubClass win02&,1

        Whilenot Ende1&

            WAITINPUT

            If %Key = 2

                Ende1& = 1

            endif

        Endwhile

        DestroyWindow(win02&)

    ElseIf %Key = 2

        Ende& = 1

    Endif

Endwhile

DeleteObject Dialogpinsel&
End

SubClassProc

    If SubClassMessage(win02&,~WM_CTLCOLORDLG)

        Set("WinProc", 0)
        '~WM_CTLCOLORDLG erwartet als Rückgabewert einen Brush für den Hintergrund
        Return Dialogpinsel&

    EndIf

'./../../function-references/XProfan/endproc/'>ENDPROC




Native Variante the idea of Andreas Miethe, with this Variant the FastMode not necessary but xpse:
CompileMarkSeparation
Declare Brush&
cls
var hDlg&=createDialog(%hWnd,"Hallo Welt",300,300,500,400)
Brush&=CreateSolidBrush($6CB6FF)
setWindowLong(hDlg&,gwl_wndProc,procAddr(myDlgProc,4))
redrawWindow(hDlg&,NULL, NULL, RDW_INVALIDATE | RDW_ERASE )

While 1

    WaitInput

EndWhile

nProc myDlgProc

    Parameters Wnd&,Msg&,WParam&,LParam&
    Global Brush&
    case Msg& = wm_ctlColorDlg : return Brush&
    Return DefDlgProc(Wnd&,Msg&,WParam&,LParam&)

ENDPROC


320 kB
Hochgeladen:11/21/09
Downloadcounter110
Download
 
11/21/09  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

3.036 Views

Untitledvor 0 min.
Sven Bader11/22/23
Rainer Hoefs06/06/23
Georg Teles02/05/23
RudiB.04/19/22
More...

Themeninformationen

this Topic has 1 subscriber:

iF (1x)


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