/* * MINIGUI - Harbour Win32 GUI library Demo */ #include "minigui.ch" FUNCTION Main() LOCAL nW, nH, aBack := GREEN, aFont := YELLOW DEFINE WINDOW Win_1 ; AT 50,100 ; WIDTH 400 ; HEIGHT 400 ; TITLE 'Replacing the window background' ; MAIN NOSIZE NOMAXIMIZE nW := This.ClientWidth - 10 //- GetBorderWidth() * 2 nH := This.ClientHeight - 10 //- GetBorderHeight() - GetTitleHeight() //@ 5, 5 LABEL Label_Del1 WIDTH nW HEIGHT nH VALUE " " INVISIBLE ; // FONT "Arial Black" SIZE 24 FONTCOLOR aFont BACKCOLOR aBack @ 300,100 BUTTON But1 CAPTION "Click Me" ; HEIGHT 65 WIDTH 200 ; ACTION ReplaceWindowBackground() END WINDOW CENTER WINDOW Win_1 ACTIVATE WINDOW Win_1 RETURN NIL FUNCTION ReplaceWindowBackground() LOCAL nW, nH, cMsg, cObj, cForm, aBack LOCAL aBold, aFold, aBwnd cForm := "Win_1" cObj := "Label_Del1" cMsg := "Replacing the window background" + CRLF + "Change window background" IF !_IsControlDefined(cObj, cForm) nW := GetProperty( cForm, "ClientWidth" ) - 10 //- GetBorderWidth()*2 nH := GetProperty( cForm, "ClientHeight" ) - 10 //- GetBorderHeight() - GetTitleHeight() aBack := BROWN @ 5, 5 LABEL &cObj PARENT &cForm WIDTH nW HEIGHT nH VALUE cMsg ; FONT "Arial Black" SIZE 24 FONTCOLOR BLACK BACKCOLOR aBack DoMethod(cForm, cObj, "ReDraw") DO EVENTS wApi_Sleep(1000) ENDIF aBOld := GetProperty( cForm, cObj, "BACKCOLOR") aFOld := GetProperty( cForm, cObj, "FONTCOLOR") aBwnd := GetProperty( cForm, "BACKCOLOR") SetProperty( cForm, "BACKCOLOR", YELLOW ) aBack := GRAY // меняем цвет формы SetProperty( cForm, cObj, "BACKCOLOR", aBack ) SetProperty( cForm, cObj, "FONTCOLOR", RED ) // BLACK SetProperty( cForm, cObj, "VALUE" , cMsg ) SetProperty( cForm, cObj, "VISIBLE" , .T. ) DO EVENTS MsgDebug("Background check!") SetProperty( cForm, cObj, "VALUE" , " " ) SetProperty( cForm, cObj, "BACKCOLOR", aBOld ) SetProperty( cForm, cObj, "FONTCOLOR", aFOld ) wApi_Sleep(1000) SetProperty( cForm, cObj, "VISIBLE" , .F. ) SetProperty( cForm, "BACKCOLOR", aBwnd ) DoMethod(cForm, cObj, 'Release') DO EVENTS RETURN NIL
|