Jump to content
Sign in to follow this  
eJan

GuiCtrlCreateGraphic paint over Label

Recommended Posts

Can be done to create graphic control over label?

I have tried with GUICtrlSetStyle($gr1, $DS_SETFOREGROUND, $WS_EX_TRANSPARENT) but I cant find the working solution

#include "GUIConstants.au3"
#include "Color.au3"

$out = DllCall("user32", "long", "GetSysColor", "long", 15)

$hColor = Hex($out[0], 6)
$hexColor = StringRight($hColor, 2) & StringMid($hColor, 3, 2) & StringLeft($hColor, 2)

GUICreate("Gradient", 260, 140)
_GUICreateGradient(0xC8C6B7, "0x" & $hexColor, 20, 20, 100, 100); To hide behind GuiCtrlCreateGraphic
_GUICreateGradient(0xFFFFFF, 0x6AC4C8, 140, 20, 100, 100); To hide behind GuiCtrlCreateGraphic

$gr1 = GuiCtrlCreateGraphic(10, 10, 120,120); To paint over _GUICreateGradient
GUICtrlSetBkColor($gr1, 0xffffff)
GUICtrlSetColor($gr1, 0)

$gr2 = GuiCtrlCreateGraphic(130, 10, 120,120); To paint over _GUICreateGradient
GUICtrlSetBkColor($gr2, 0xEDBCDE)
GUICtrlSetColor($gr2, 0)

GUISetState()

Do
    $msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE

Func _GUICreateGradient($nStartColor, $nEndColor, $nX, $nY, $nWidth, $nHeight)
    Local $color1R = _ColorGetRed($nStartColor)
    Local $color1G = _ColorGetGreen($nStartColor)
    Local $color1B = _ColorGetBlue($nStartColor)
    
    Local $nStepR = (_ColorGetRed($nEndColor) - $color1R) / $nHeight
    Local $nStepG = (_ColorGetGreen($nEndColor) - $color1G) / $nHeight
    Local $nStepB = (_ColorGetBlue($nEndColor) - $color1B) / $nHeight
    For $i = 0 To $nHeight
        $sColor = "0x" & StringFormat("%02X%02X%02X", $color1R + $nStepR * $i, $color1G + $nStepG * $i, $color1B + $nStepB * $i)
        $label = GUICtrlCreateLabel("", $nX, $nY + $i, $nWidth, 1)
        GUICtrlSetBkColor($label, $sColor)
    Next
EndFunc

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  

×
×
  • Create New...