Jump to content

Scroll text on a picture with transparent backgound


 Share

Recommended Posts

Hi,

I have made some test using the vertical scroll text fond on this forum but I can't found how to write a text with a transparent background scrolling on a picture...

I've tested many style and extended style on th label but the result is some weirds effects like a scroll of a part of the screen...

Here is my actual script:

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 0)
$AboutGUI = GUICreate("About", 436, 251, -1, -1, $WS_POPUP)
WinSetOnTop("About", "", 1)
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic(@ScriptDir & "\about.gif", 0, 0, 436, 251)
GUICtrlSetState(-1, $GUI_DISABLE)

$close = GUICtrlCreateButton(" Ok! ", 380, 75, 35, 22)
$win = WinGetPos("About")
$child = GUICreate("About scroller", 325, 115, $win[0]+110, $win[1]+125, $WS_POPUP, $WS_EX_TRANSPARENT, $AboutGUI)
GUISetBkColor(0xFFFFFF)
$AboutLabel = GUICtrlCreateLabel("This is a test"&@CRLF&"Background is solid and the picture is masked..."&@CRLF&"I don't found how to put a transparent background. All my tries"&@CRLF&"with back color settings for the label gives amazing effects like a picture scroll"&@CRLF&"in a part of the screen...."&@CRLF&@CRLF&@CRLF, 1, -80, 320, 355, BitOr($SS_NOTIFY, $SS_RIGHT))
GUISetState(@SW_SHOW, $AboutGUI)
GUISetState(@SW_SHOW, $child)

While 1
    For $i = -105 to 380
        $msg = GUIGetMsg()
        ControlMove("About scroller", "", $AboutLabel, 1, 30-$i)
        If $msg = $close Then
            Opt("GUIOnEventMode", 1)
            GUIDelete($AboutGUI)
            Exit
        EndIf
        sleep(50)
    Next
WEnd
Edited by Starcom
Link to comment
Share on other sites

Thanks but I've already try these examples...

Sure I will try again. But at this time, I haven't found any solution for my problem.

Here is my more amazing try which scroll a part of the picture in a part of the screen then it scroll the "Ok" button :)

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 0)
$AboutGUI = GUICreate("About", 436, 251, -1, -1, $WS_POPUP)
WinSetOnTop("About", "", 1)
GUICtrlSetState(Default, $GUI_DISABLE)
GUICtrlCreatePic(@ScriptDir & "\about.gif", 0, 0, 436, 251)
GUICtrlSetState(-1, $GUI_DISABLE)

$close = GUICtrlCreateButton(" Ok! ", 380, 75, 35, 22)
$win = WinGetPos("About")
$child = GUICreate("About scroller", 325, 115, $win[0]+110, $win[1]+125, $WS_POPUP, $WS_EX_TRANSPARENT, $AboutGUI)
$AboutLabel = GUICtrlCreateLabel("This is a test"&@CRLF&"Background is solid and the picture is masked..."&@CRLF&"I don't found how to put a transparent background. All my tries"&@CRLF&"with back color settings for the label gives amazing effects like a picture scroll"&@CRLF&"in a part of the screen...."&@CRLF&@CRLF&@CRLF, 1, -80, 320, 355, BitOr($SS_NOTIFY, $SS_RIGHT, $GUI_BKCOLOR_TRANSPARENT))
GUISetState(@SW_SHOW, $AboutGUI)
GUISetState(@SW_SHOW, $child)
GUICtrlSetState(Default, $GUI_BKCOLOR_TRANSPARENT)

While 1
    For $i = -105 to 380
        $msg = GUIGetMsg()
        ControlMove("About scroller", "", $AboutLabel, 1, 30-$i)
        If $msg = $close Then
            Opt("GUIOnEventMode", 1)
            GUIDelete($AboutGUI)
            Exit
        EndIf
        sleep(50)
    Next
WEnd
Link to comment
Share on other sites

There must be a better way to do it than this:

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
HotKeySet("{Esc}","Quit")

Global $text = "Transparent vertical" & @CR & "scrolling text example" & @CR & "coded by mikehunt114"

$testGUI = GUICreate("Transparent Vertical Scrolling Text", 400, 400)
GUISetBkColor(0xFFFFFF, $testGUI)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")

$label1 = GUICtrlCreateLabel($text, 10, 250, 147, 50)
$hideLabel1 = GUICtrlCreateLabel("", 10, 250, 150, 55)
$hideLabel2 = GUICtrlCreateLabel("", 10, 90, 150, 70)
GUICtrlSetBkColor($label1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor($hideLabel1, 0xFFFFFF)
GUICtrlSetBkColor($hideLabel2, 0xFFFFFF)

GUISetState(@SW_SHOW, $testGUI)

While 1
    For $i = 250 To -50 Step -1
        GUICtrlSetPos($label1, 10, $i)
        Sleep(40)
    Next
WEnd

Func Quit() 
    Exit 0
EndFunc
Edited by mikehunt114
IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

It's a bit choppy, there's probably a better way to draw it, maybe someone else can one-up me.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...