Jump to content

Recommended Posts

Posted (edited)

Dear Experts,

Is there anyway to set the display of txt background in Marquee to bee fully transparent when there is image baground used in Gui

here is the code :

#include <GUIConstantsEx.au3>
#include <Marquee.au3>

Local $hGui = GUICreate("", 500, 300)
GUISetBkColor(1193046, $hGui)
GUICtrlCreatePic(@ProgramFilesDir & "\AutoIt3\Examples\GUI\msoobe.jpg", 0, 0, 500, 300)
GUICtrlSetState(-1, $GUI_DISABLE)

$stext = "«USER Soft 2026» Presents : USER Assist Tool ... «USER Soft 2026» Presents : USER Assist Tool ..."
;$imarqueeindex = _guictrlmarquee_init()
_GUICtrlMarquee_SetScroll(0, Default, "left", Default, 200)
_GUICtrlMarquee_SetDisplay(1, "White", 1193046, 12, "Arial")  ; Change backgtound color
_GUICtrlMarquee_Create($stext, 15, 85, 400, 25)  ; Change position

GUISetState()

While True
    If GUIGetMsg()=-3 Then Exit
WEnd

 

to retrieve the marquee.au3 UDF created by : Melba23 used from here :

https://www.autoitscript.com/forum/topic/103904-info-bar-like-tickertape/#findComment-735769

we need to set txt to scroll freely with transparent background (means the gui .jpg image will apperar under the Marquee txt in Marquee)

Thanks in advance

Edited by Davidyese
  • Davidyese changed the title to Set display of background color of txt in Marquee to be Transparent over .jpg image in Gui
Posted

Well, the code does not work anymore in Windows 11 (at least for me).  But I had this code written back then...You may have some use of it.

; From Nine
#include <GUIConstants.au3>
#include <WinAPISysWin.au3>

Global $iLen, $idLabel

Example()

Func Example()
  Local $hGUI = GUICreate("Maquee", 500, 300)
  GUISetBkColor(1193046, $hGUI)
  GUICtrlCreatePic(@ProgramFilesDir & "\AutoIt3\Examples\GUI\msoobe.jpg", 0, 0, 500, 300)
  GUICtrlSetState(-1, $GUI_DISABLE)
  Local $sString = "«USER Soft 2026» Presents : USER Assist Tool ..."
  GUISetState()

  Local $hGUI2 = GUICreate("", 300, 30, 100, 100, $WS_POPUP, BitOR($WS_EX_COMPOSITED, $WS_EX_MDICHILD, $WS_EX_LAYERED), $hGUI)
  GUISetBkColor(0xABCDEF)
  GUISetFont(14)
  $sString &= "          "
  $idLabel = GUICtrlCreateLabel($sString, 0, -30, -1, 30, $SS_NOPREFIX + $SS_LEFTNOWORDWRAP)
  $iLen = ControlGetPos($hGUI2, "", $idLabel)[2] - 9 ; to get exact length
  GUICtrlDelete($idLabel)

  $idLabel = GUICtrlCreateLabel($sString & $sString, 0, 0, $iLen * 2, 30, BitOR($SS_NOPREFIX, $SS_LEFTNOWORDWRAP))
  GUICtrlSetColor(-1, 0xFFFFFF)

  _WinAPI_SetLayeredWindowAttributes($hGUI2, 0xABCDEF)
  GUISetState()

  Local $hTimerProc = DllCallbackRegister(Scroll, 'none', 'hwnd;uint;uint_ptr;dword')
  Local $iTimerID = _WinAPI_SetTimer($hGUI, 0, 25, DllCallbackGetPtr($hTimerProc))

  Do
  Until GUIGetMsg() = $GUI_EVENT_CLOSE

  _WinAPI_KillTimer($hGUI, $iTimerID)
  DllCallbackFree($hTimerProc)
EndFunc   ;==>Example

Func Scroll($hWnd, $iMsg, $iTimerID, $iTime)
  Local Static $iPos = 0
  $iPos -= 1
  If -$iPos = $iLen Then $iPos = 0
  GUICtrlSetPos($idLabel, $iPos)
EndFunc   ;==>Scroll

 

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
×
×
  • Create New...