Jump to content

Background image viewable text?


xShadowx
 Share

Recommended Posts

Maybe this be easy:

#include <GuiConstantsEx.au3>

$hGUI = GUICreate("Test", 300, 200)

$pic = GUICtrlCreatePic(@WindowsDir & "\Web\Wallpaper\Windows XP.jpg", 10, 10, 280, 180)
GUICtrlSetState(-1, $GUI_DISABLE)

GUICtrlCreateLabel("Test Text", 120, 75, 100, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

GUISetState()

Do
Until GUIGetMsg() = -3
Link to comment
Share on other sites

Ok, when I do that, I have to press the exit button before I can see the input boxes/buttons. Is there a way around that?

Maybe you have created the buttons and inputs before the pic. If so move them so they are created after the pic.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Ok, when I do that, I have to press the exit button before I can see the input boxes/buttons. Is there a way around that?

Try adding the style $WS_CLIPSIBLINGS to the pic. I would expect that to fix it.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Do you mean like this?

GUICtrlCreatePic("bg.jpg", 0, 0, 131, 330, $WS_CLIPSIBLINGS)

Because it doesnt work.

One last attempt. If you use $WS_CLIPSIBLINGS then try creating the pic after the other controls instead of before.

If that doesn't work then I need to see some code that shows the problem because I can't reproduce it.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("TrayIconHide", 1)
opt("GUIResizeMode",$GUI_DOCKALL)

$name = ''
$pass = ''
While $name = '' Or $pass = ''
    GetUserName($name, $pass)
WEnd



Func GetUserName(ByRef $nn, ByRef $pp)
; GUI
    $Form1 = GUICreate("", 131, 220, 619, 451)
    GUICtrlCreateLabel("New User Name?", 5, 5, 770, 20, -1, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreateLabel("Confirm Name.", 5, 46, 770, 20, -1, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreateLabel("Password?", 5, 110, 770, 20, -1, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreateLabel("Confirm Password.", 5, 150, 770, 20, -1, $GUI_WS_EX_PARENTDRAG)
    GUISetState(@SW_SHOW)


    $pic = GUICtrlCreatePic("back.jpg", 0, 0, 131, 290)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreateLabel("New User Name", 5, 5, 770, 20)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUISetState()
    Do
    Until GUIGetMsg() = -3


;$
    $Input1 = GUICtrlCreateInput("", 5, 22, 121, 21)
    $Input2 = GUICtrlCreateInput("", 5, 62, 121, 21)
    $check = GUICtrlCreateButton("Ok", 5, 90, 75, 17, 0)
    $Input3 = GUICtrlCreateInput("", 5, 126, 121, 21)
    $Input4 = GUICtrlCreateInput("", 5, 166, 121, 21)
    $check1 = GUICtrlCreateButton("Ok", 5, 194, 75, 17, 0)
    GUICtrlCreateLabel("",0,225,131,1)
    GUICtrlSetBkColor(-1,0x666666)
    $alldone = GUICtrlCreateButton("Apply", 30, 230, 70, 22)
    Local $popup
    Local $popup1
$expanded = false

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $check
                
                If GUICtrlRead($Input1) <> '' and GUICtrlRead($Input1) = GUICtrlRead($Input2) Then
                    $nn = GUICtrlRead($Input1)
                    GUICtrlDelete($popup)
                    $popup = GUICtrlCreateButton("", 100, 90, 25, 17, 0)
                    GUICtrlSetBkColor(-1, 0x00CC00)
                Else
                    $nn = ''
                    $popup = GUICtrlCreateButton("", 100, 90, 25, 17, 0)
                    GUICtrlSetBkColor(-1, 0xFF0000)
                EndIf
                
            Case $check1
                If GUICtrlRead($Input3) <> '' and GUICtrlRead($Input3) = GUICtrlRead($Input4) Then
                    $pp = GUICtrlRead($Input3)
                    GUICtrlDelete($popup1)
                    $popup1 = GUICtrlCreateButton("", 100, 194, 25, 17, 0)
                    GUICtrlSetBkColor(-1, 0x00CC00)
                Else
                    $pp = ''
                    $popup1 = GUICtrlCreateButton("", 100, 194, 25, 17, 0)
                    GUICtrlSetBkColor(-1, 0xFF0000)
                EndIf
            Case $alldone
                If $nn <> '' And $pp <> '' Then
                    ExitLoop
                Else
                    MsgBox(262144, "ERROR", "Please enter your User Name and Password")
                EndIf
        EndSwitch
        
        if not $expanded Then
            If $nn <> '' And $pp <> '' Then
                winmove($Form1,"", 619, 451,137, 290)
            EndIf
        EndIf
        
        
    WEnd
    
    GUIDelete($Form1)
    Return
EndFunc

Edited by xShadowx
Link to comment
Share on other sites

#include <ButtonConstants.au3>
 #include <EditConstants.au3>
 #include <GUIConstantsEx.au3>
 #include <WindowsConstants.au3>
 Opt("TrayIconHide", 1)
 opt("GUIResizeMode",$GUI_DOCKALL)
 
 $name = ''
 $pass = ''
 While $name = '' Or $pass = ''
     GetUserName($name, $pass)
 WEnd
 
 
 
 Func GetUserName(ByRef $nn, ByRef $pp)
; GUI
     $Form1 = GUICreate("", 131, 220, 619, 451)
     GUICtrlCreateLabel("New User Name?", 5, 5, 770, 20, -1, $GUI_WS_EX_PARENTDRAG)
     GUICtrlCreateLabel("Confirm Name.", 5, 46, 770, 20, -1, $GUI_WS_EX_PARENTDRAG)
     GUICtrlCreateLabel("Password?", 5, 110, 770, 20, -1, $GUI_WS_EX_PARENTDRAG)
     GUICtrlCreateLabel("Confirm Password.", 5, 150, 770, 20, -1, $GUI_WS_EX_PARENTDRAG)
     GUISetState(@SW_SHOW)
 
;$
     $Input1 = GUICtrlCreateInput("", 5, 22, 121, 21)
     $Input2 = GUICtrlCreateInput("", 5, 62, 121, 21)
     $check = GUICtrlCreateButton("Ok", 5, 90, 75, 17, 0)
     $Input3 = GUICtrlCreateInput("", 5, 126, 121, 21)
     $Input4 = GUICtrlCreateInput("", 5, 166, 121, 21)
     $check1 = GUICtrlCreateButton("Ok", 5, 194, 75, 17, 0)
     GUICtrlCreateLabel("",0,225,131,1)
     GUICtrlSetBkColor(-1,0x666666)
     $alldone = GUICtrlCreateButton("Apply", 30, 230, 70, 22)
     Local $popup
     Local $popup1
 $expanded = false
 
     While 1
         $nMsg = GUIGetMsg()
         Switch $nMsg
             Case $GUI_EVENT_CLOSE
                 ExitLoop
             Case $check
                 
                 If GUICtrlRead($Input1) <> '' and GUICtrlRead($Input1) = GUICtrlRead($Input2) Then
                     $nn = GUICtrlRead($Input1)
                     GUICtrlDelete($popup)
                     $popup = GUICtrlCreateButton("", 100, 90, 25, 17, 0)
                     GUICtrlSetBkColor(-1, 0x00CC00)
                 Else
                     $nn = ''
                     $popup = GUICtrlCreateButton("", 100, 90, 25, 17, 0)
                     GUICtrlSetBkColor(-1, 0xFF0000)
                 EndIf
                 
             Case $check1
                 If GUICtrlRead($Input3) <> '' and GUICtrlRead($Input3) = GUICtrlRead($Input4) Then
                     $pp = GUICtrlRead($Input3)
                     GUICtrlDelete($popup1)
                     $popup1 = GUICtrlCreateButton("", 100, 194, 25, 17, 0)
                     GUICtrlSetBkColor(-1, 0x00CC00)
                 Else
                     $pp = ''
                     $popup1 = GUICtrlCreateButton("", 100, 194, 25, 17, 0)
                     GUICtrlSetBkColor(-1, 0xFF0000)
                 EndIf
             Case $alldone
                 If $nn <> '' And $pp <> '' Then
                     ExitLoop
                 Else
                     MsgBox(262144, "ERROR", "Please enter your User Name and Password")
                 EndIf
         EndSwitch
         
         if not $expanded Then
             If $nn <> '' And $pp <> '' Then
                 winmove($Form1,"", 619, 451,137, 290)
             EndIf
         EndIf
         
         
     WEnd
     
     GUIDelete($Form1)
     Return
 EndFunc

There is no GUICtrlCreatePic() in this code....

... So I cant help you!

8)

NEWHeader1.png

Link to comment
Share on other sites

Errors include....

GUISetState(@SW_SHOW) ; Removed

Do ; Removed

Until GUIGetMsg() = -3

Working code....

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("TrayIconHide", 1)
Opt("GUIResizeMode", $GUI_DOCKALL)

$name = ''
$pass = ''



While $name = '' Or $pass = ''
    GetUserName($name, $pass)
WEnd



Func GetUserName(ByRef $nn, ByRef $pp)
    ; GUI
    $Form1 = GUICreate("", 131, 220, 619, 451)
    GUICtrlCreateLabel("New User Name?", 5, 5, 770, 20, -1, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreateLabel("Confirm Name.", 5, 46, 770, 20, -1, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreateLabel("Password?", 5, 110, 770, 20, -1, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreateLabel("Confirm Password.", 5, 150, 770, 20, -1, $GUI_WS_EX_PARENTDRAG)


    $pic = GUICtrlCreatePic("back.jpg", 0, 0, 131, 290)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreateLabel("Test Text", 120, 75, 100, 20)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUISetState()

    ;$
    $Input1 = GUICtrlCreateInput("", 5, 22, 121, 21)
    $Input2 = GUICtrlCreateInput("", 5, 62, 121, 21)
    $check = GUICtrlCreateButton("Ok", 5, 90, 75, 17, 0)
    $Input3 = GUICtrlCreateInput("", 5, 126, 121, 21)
    $Input4 = GUICtrlCreateInput("", 5, 166, 121, 21)
    $check1 = GUICtrlCreateButton("Ok", 5, 194, 75, 17, 0)
    GUICtrlCreateLabel("", 0, 225, 131, 1)
    GUICtrlSetBkColor(-1, 0x666666)
    $alldone = GUICtrlCreateButton("Apply", 30, 230, 70, 22)
    Local $popup
    Local $popup1
    $expanded = False

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $check

                If GUICtrlRead($Input1) <> '' And GUICtrlRead($Input1) = GUICtrlRead($Input2) Then
                    $nn = GUICtrlRead($Input1)
                    GUICtrlDelete($popup)
                    $popup = GUICtrlCreateButton("", 100, 90, 25, 17, 0)
                    GUICtrlSetBkColor(-1, 0x00CC00)
                Else
                    $nn = ''
                    $popup = GUICtrlCreateButton("", 100, 90, 25, 17, 0)
                    GUICtrlSetBkColor(-1, 0xFF0000)
                EndIf

            Case $check1
                If GUICtrlRead($Input3) <> '' And GUICtrlRead($Input3) = GUICtrlRead($Input4) Then
                    $pp = GUICtrlRead($Input3)
                    GUICtrlDelete($popup1)
                    $popup1 = GUICtrlCreateButton("", 100, 194, 25, 17, 0)
                    GUICtrlSetBkColor(-1, 0x00CC00)
                Else
                    $pp = ''
                    $popup1 = GUICtrlCreateButton("", 100, 194, 25, 17, 0)
                    GUICtrlSetBkColor(-1, 0xFF0000)
                EndIf
            Case $alldone
                If $nn <> '' And $pp <> '' Then
                    ExitLoop
                Else
                    MsgBox(262144, "ERROR", "Please enter your User Name and Password")
                EndIf
        EndSwitch

        If Not $expanded Then
            If $nn <> '' And $pp <> '' Then
                WinMove($Form1, "", 619, 451, 137, 290)
            EndIf
        EndIf


    WEnd

    GUIDelete($Form1)
    Return
EndFunc   ;==>GetUserName

NEWHeader1.png

Link to comment
Share on other sites

So, I guess your original problem went away?

I changed the first red text line for you

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("TrayIconHide", 1)
Opt("GUIResizeMode", $GUI_DOCKALL)

$name = ''
$pass = ''



While $name = '' Or $pass = ''
    GetUserName($name, $pass)
WEnd



Func GetUserName(ByRef $nn, ByRef $pp)
    ; GUI
    $Form1 = GUICreate("", 131, 220, 619, 451)
    GUICtrlCreateLabel("New User Name?", 5, 5, 770, 20, -1, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetColor( -1, 0xFF0000)
    GUICtrlCreateLabel("Confirm Name.", 5, 46, 770, 20, -1, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreateLabel("Password?", 5, 110, 770, 20, -1, $GUI_WS_EX_PARENTDRAG)
    GUICtrlCreateLabel("Confirm Password.", 5, 150, 770, 20, -1, $GUI_WS_EX_PARENTDRAG)


    $pic = GUICtrlCreatePic("back.jpg", 0, 0, 131, 290)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreateLabel("Test Text", 120, 75, 100, 20)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUISetState()

    ;$
    $Input1 = GUICtrlCreateInput("", 5, 22, 121, 21)
    $Input2 = GUICtrlCreateInput("", 5, 62, 121, 21)
    $check = GUICtrlCreateButton("Ok", 5, 90, 75, 17, 0)
    $Input3 = GUICtrlCreateInput("", 5, 126, 121, 21)
    $Input4 = GUICtrlCreateInput("", 5, 166, 121, 21)
    $check1 = GUICtrlCreateButton("Ok", 5, 194, 75, 17, 0)
    GUICtrlCreateLabel("", 0, 225, 131, 1)
    GUICtrlSetBkColor(-1, 0x666666)
    $alldone = GUICtrlCreateButton("Apply", 30, 230, 70, 22)
    Local $popup
    Local $popup1
    $expanded = False

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $check

                If GUICtrlRead($Input1) <> '' And GUICtrlRead($Input1) = GUICtrlRead($Input2) Then
                    $nn = GUICtrlRead($Input1)
                    GUICtrlDelete($popup)
                    $popup = GUICtrlCreateButton("", 100, 90, 25, 17, 0)
                    GUICtrlSetBkColor(-1, 0x00CC00)
                Else
                    $nn = ''
                    $popup = GUICtrlCreateButton("", 100, 90, 25, 17, 0)
                    GUICtrlSetBkColor(-1, 0xFF0000)
                EndIf

            Case $check1
                If GUICtrlRead($Input3) <> '' And GUICtrlRead($Input3) = GUICtrlRead($Input4) Then
                    $pp = GUICtrlRead($Input3)
                    GUICtrlDelete($popup1)
                    $popup1 = GUICtrlCreateButton("", 100, 194, 25, 17, 0)
                    GUICtrlSetBkColor(-1, 0x00CC00)
                Else
                    $pp = ''
                    $popup1 = GUICtrlCreateButton("", 100, 194, 25, 17, 0)
                    GUICtrlSetBkColor(-1, 0xFF0000)
                EndIf
            Case $alldone
                If $nn <> '' And $pp <> '' Then
                    ExitLoop
                Else
                    MsgBox(262144, "ERROR", "Please enter your User Name and Password")
                EndIf
        EndSwitch

        If Not $expanded Then
            If $nn <> '' And $pp <> '' Then
                WinMove($Form1, "", 619, 451, 137, 290)
            EndIf
        EndIf


    WEnd

    GUIDelete($Form1)
    Return
EndFunc   ;==>GetUserName

8)

NEWHeader1.png

Link to comment
Share on other sites

Thanks mate, I only thing I needed was:

GUICtrlCreateLabel("text", 5, 5, 770, 20)
GUICtrlSetColor( -1, 0xcolor)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

Thanks for your help.

>=-D

Edit: Is there a way to make the text bold? Also, is there a way to somehow build the image into the exe, so there is no need for an image outside the program? Like so there is no need for an image in a specific directory?

Edited by xShadowx
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...