Sign in to follow this  
Followers 0
xroot

Simple Background Gradient

3 posts in this topic

Here is a very simple background gradient script.

No need for dll calls and with a very small amount of code.

So if you need or want background gradient in your app. this might work for you.

Change the sColor and eColor for different start and end color gradient.

Go and have some fun.

Func GRADIENT()
    If $GT Then
        $GT=0
        WinSetTitle($hWin,"",$TIT&"Vertical")
    Else
        $GT=1
        WinSetTitle($hWin,"",$TIT&"Horizontal")
    EndIf
    $SE.document.Body.Style.Filter="PROGID:DXImageTransform.Microsoft.Gradient(GradientType="& _
                                   $GT&",StartColorStr="&$sColor&",EndColorStr="&$eColor&")"
    GUICtrlSetState($Button1,$GUI_SHOW)
    Return
EndFunc

Global Const $GUI_EVENT_CLOSE=-3
Global Const $GUI_DISABLE=128
Global Const $WM_LBUTTONDOWN=0x0201
Global Const $GUI_SHOW=16
Global Const $BS_BITMAP=0x0081
Global $GT=1,$sColor="blue",$eColor="red"
Local $W=400,$H=400

$SE=ObjCreate("Shell.Explorer")
$hWin=GuiCreate("Simple Gradient - Left Click Gradient - ",$W,$H)
$TIT=WinGetTitle($hWin)
$oSE=GUICtrlCreateObj($SE,0,0,$W,$H)
GUICtrlSetState(-1,$GUI_DISABLE)
$Button1=GUICtrlCreateButton("",300,300,55,55,$BS_BITMAP)
GUICtrlSetImage(-1,@ScriptDir&"\exit.bmp")

$SE.Navigate("about:blank")
While $SE.Busy
    Sleep(1)
WEnd
$SE.document.Body.Scroll="no"
$SE.document.Body.Style.BorderWidth=0
GRADIENT()

GUIRegisterMsg($WM_LBUTTONDOWN,"GRADIENT")
GuiSetState()

While True
    Local $ESC=DllCall("User32.dll","short","GetAsyncKeyState","int",0x1B)
    If $ESC[0]<>0 Then Exit
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE,$Button1
            Exit
    EndSwitch
WEnd

exit.bmp

Share this post


Link to post
Share on other sites



Works perfect!!!

Great job. >_<

Share this post


Link to post
Share on other sites

Good stuff!! Works great.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0