Jump to content

GUICtrlCreatePic


rudika
 Share

Recommended Posts

Moin, moin, friends...:whistle:

In my present project I have to build forwards into the GUI total surface a picture with GUICtrlCreatePic.

But if i use GUICtrlCreateLabel, too, there is an ugly gray line behind the text string. How do i can get the

letters directly on the background picture. I already looked for it in this forum, but i guess i use the wrong

keywords.

Is somebody here, who know an answer to this question for me, to get a beautiful design of my GUI.

Thanks at everyone who helps me.

Greets Rudika

[font="Comic Sans Ms"][center]Powered by AutoIt3http://www.wik-eric.de/zips/Synchro2.2.2-4free.zip[/center][/font]

Link to comment
Share on other sites

Can we have a look at the script please? Labels are normally transparent background.

I hope the function for the GUI will be enough for you to help me.

Func UserInput()

GUICreate($Titel, 290,300, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018); WS_EX_ACCEPTFILES
GUICtrlCreatePic("SL-Logo.jpg", 0,0,521,100,0x00000020)
GUICtrlCreateLabel("Simulationsart", 20, 15, 218, 13)
Opt("GUICoordMode",1)
$radio1 = GUICtrlCreateRadio("Drehung R/L und Texteingabe im Chat", 20, 40, 218, 13)
$radio2 = GUICtrlCreateRadio("nur Drehung R/L", 20, 60, 218, 13)
$radio3 = GUICtrlCreateRadio("nur Texteingabe im Chat", 20, 80, 218, 13)
GUICtrlSetState ($radio1,$GUI_CHECKED)

GUICtrlCreateLabel("Zeittakteingabe", 20, 115, 218, 13)
GUICtrlCreateLabel("Bitte gebe hier den Zeittakt in Minuten ein.",20,140,218,13)
$time = GUICtrlCreateInput ( $Takt, 240,  135, 25, 20)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)

GUICtrlCreateLabel ("Bitte die Textdatei mit den Sprüchen auswählen...",  20, 175, 250, 20)
$GetFile = GUICtrlCreateCombo ("", 20,200,250,20)
GUICtrlSetData(-1, $TxT, $DefFile)

$btn_1 = GUICtrlCreateButton ("Abbrechen", 30,  240, 100, 40, 0x0001)
$btn_2 = GUICtrlCreateButton ("Okay", 160,  240, 100, 40, 0x0001)

GUISetState () 

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
            Case $msg = $radio1
                GUICtrlSetState ($radio1,$GUI_CHECKED)
                $Opt = 1
            Case $msg = $radio2
                GUICtrlSetState ($radio2,$GUI_CHECKED)
                $Opt = 2
            Case $msg = $radio3
                GUICtrlSetState ($radio3,$GUI_CHECKED)
                $Opt = 3
            Case $msg = $btn_2
                $Takt = GUICtrlRead($time)
                $file = GUICtrlRead($GetFile)
                $Takt = $Takt & "0000"
                ExitLoop
            Case $msg = $time               
                $Takt = GUICtrlRead($time)
            Case $msg = $btn_1
                exit
            Case $msg = $GUI_EVENT_CLOSE
                exit
       EndSelect
Wend

GUISetState(@SW_HIDE)
EndFunc

thank you for your fast reaction...

[font="Comic Sans Ms"][center]Powered by AutoIt3http://www.wik-eric.de/zips/Synchro2.2.2-4free.zip[/center][/font]

Link to comment
Share on other sites

Hmm, can you post your whole script, so I can see what it fully does, as I cannot test it.

okay, if you think it is necessarily for you, here is my whole code...

#include <Constants.au3>
#include <GuiConstants.au3>
#include <Misc.au3>
;#NoTrayIcon
;Opt("GUICoordMode",1)

$Takt = "6"
$Titel = "SL User-Sim 1.0"
$Opt=1
$DefFile = "text.txt"
$file = $DefFile
$TxT = ""
$TxTfile = ""

$search = FileFindFirstFile("*.txt")
While 1
    $TxTfile = FileFindNextFile($search)
    If @error Then ExitLoop
    If $TxTfile = "." Then
    ElseIf $TxTfile = ".." Then
    ElseIf $TxT = "" Then
        $TxT = $TxTfile
    Else
        $TxT = $TxT & "|" & $TxTfile
    EndIf
WEnd

FileClose($search)

UserInput()

Select
    Case $Opt = 1
        Function_1()
    Case $Opt = 2
        Function_2()
    Case $Opt = 3
        Function_3()
EndSelect


Func UserInput()

GUICreate($Titel, 290,300, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018); WS_EX_ACCEPTFILES
GUICtrlCreatePic("SL-Logo.jpg", 0,0,521,100,0x00000020)
GUICtrlCreateLabel("Simulationsart", 20, 15, 218, 13)
Opt("GUICoordMode",1)
$radio1 = GUICtrlCreateRadio("Drehung R/L und Texteingabe im Chat", 20, 40, 218, 13)
$radio2 = GUICtrlCreateRadio("nur Drehung R/L", 20, 60, 218, 13)
$radio3 = GUICtrlCreateRadio("nur Texteingabe im Chat", 20, 80, 218, 13)
GUICtrlSetState ($radio1,$GUI_CHECKED)

GUICtrlCreateLabel("Zeittakteingabe", 20, 115, 218, 13)
GUICtrlCreateLabel("Bitte gebe hier den Zeittakt in Minuten ein.",20,140,218,13)
$time = GUICtrlCreateInput ( $Takt, 240,  135, 25, 20)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)

GUICtrlCreateLabel ("Bitte die Textdatei mit den Sprüchen auswählen...",  20, 175, 250, 20)
$GetFile = GUICtrlCreateCombo ("", 20,200,250,20)
GUICtrlSetData(-1, $TxT, $DefFile)

$btn_1 = GUICtrlCreateButton ("Abbrechen", 30,  240, 100, 40, 0x0001)
$btn_2 = GUICtrlCreateButton ("Okay", 160,  240, 100, 40, 0x0001)

GUISetState () 

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
            Case $msg = $radio1
                GUICtrlSetState ($radio1,$GUI_CHECKED)
                $Opt = 1
            Case $msg = $radio2
                GUICtrlSetState ($radio2,$GUI_CHECKED)
                $Opt = 2
            Case $msg = $radio3
                GUICtrlSetState ($radio3,$GUI_CHECKED)
                $Opt = 3
            Case $msg = $btn_2
                $Takt = GUICtrlRead($time)
                $file = GUICtrlRead($GetFile)
                $Takt = $Takt * 60000
                ExitLoop
            Case $msg = $time               
                $Takt = GUICtrlRead($time)
            Case $msg = $btn_1
                exit
            Case $msg = $GUI_EVENT_CLOSE
                exit
       EndSelect
Wend

GUISetState(@SW_HIDE)
EndFunc

Func Function_1()
$open = FileOpen($file, 0)
$count=1
$i=0
While $i=0
    Sleep(1000)
    If WinActive("Second Life") Then
        Send("{left down}")
        Sleep(2000)
        Send("{left up}")
        Sleep($Takt)
        If WinActive("Second Life") Then 
            Send("{right down}")
            Sleep(2000)
            Send("{right up}")
            Sleep($Takt)
            If WinActive("Second Life") Then
                $text = FileReadLine($file, $count)
                Send($text & "{ENTER}")
                If $text = "" Then 
                    $count = 1
                Else
                    $count = $count + 1
                EndIf
                Sleep(10000)
                If WinActive("Second Life") Then
                    $text = FileReadLine($file, $count)
                    Send($text & "{ENTER}")
                    If $text = "" Then 
                        $count = 1
                    Else
                        $count = $count + 1
                    EndIf
                EndIf
            EndIf
        EndIf   
    EndIf
WEnd
FileClose($open)
EndFunc

Func Function_2()
$i=0
While $i=0
    Sleep(1000)
    If WinActive("Second Life") Then
        Send("{left down}")
        Sleep(2000)
        Send("{left up}")
        Sleep($Takt)
        If WinActive("Second Life") Then 
            Send("{right down}")
            Sleep(2000)
            Send("{right up}")
            Sleep($Takt)
        EndIf
    EndIf
WEnd
EndFunc

Func Function_3()
$open = FileOpen($file, 0)
$count=1
$i=0
While $i=0
    Sleep(1000)
    If WinActive("Second Life") Then
        $text = FileReadLine($file, $count)
        If $text = "" Then 
            $count = 1
        Else
            Send($text & "{ENTER}")
            $count = $count + 1
        EndIf
        Sleep($Takt)
        If WinActive("Second Life") Then
            $text = FileReadLine($file, $count)
            If $text = "" Then 
                $count = 1
            Else
                Send($text & "{ENTER}")
                $count = $count + 1
            EndIf
        EndIf
    EndIf
WEnd
FileClose($open)
EndFunc
Edited by rudika

[font="Comic Sans Ms"][center]Powered by AutoIt3http://www.wik-eric.de/zips/Synchro2.2.2-4free.zip[/center][/font]

Link to comment
Share on other sites

Nice GUI. Can you also upload the picture :whistle:

Second Life, I wanna play that. *cough* sorry.

oh, sorry, i am at work right now, and the picture is on my computer at home, please wait until i am at home again, then i will post you the logo picture, this afternoon at 6 o'clock i guess.

[font="Comic Sans Ms"][center]Powered by AutoIt3http://www.wik-eric.de/zips/Synchro2.2.2-4free.zip[/center][/font]

Link to comment
Share on other sites

now the bells can ring for the weekend... :whistle:

i really don´t understand what with the picture can be, to answer my question, but here i will post now the last version of code and all other needed files to run my program. but the effects of the program are only aktiv if you play Second Life and want to make a brake for a longer time. that´s the reason fro my idea to programing this little tool.

SL_User.zip

Edited by rudika

[font="Comic Sans Ms"][center]Powered by AutoIt3http://www.wik-eric.de/zips/Synchro2.2.2-4free.zip[/center][/font]

Link to comment
Share on other sites

Apparently GUICtrlSetBkColor( -1, $GUI_BKCOLOR_TRANSPARENT ) is not working corectly

try this....

#include <Constants.au3>
#include <GuiConstants.au3>


GUICreate("pic test", 290,340, @DesktopWidth/2-160, @DesktopHeight/2-45)

GUICtrlCreatePic("SL-Logo.jpg", 0,0,290,340)
GUICtrlSetState( -1, $GUI_DISABLE)

GUICtrlCreateLabel("Simulationsart", 20, 100, 68, 14)
GUICtrlSetBkColor( -1, $GUI_BKCOLOR_TRANSPARENT )

$radio1 = GUICtrlCreateRadio("", 20, 40, 12, 12)
$radio1 = GUICtrlCreateLabel("Drehung R/L und Texteingabe im Chat", 32, 40, 205, 14)
GUICtrlSetBkColor( -1, $GUI_BKCOLOR_TRANSPARENT )

$radio2 = GUICtrlCreateCheckbox("nur Drehung R/L", 20, 60, 102, 14) ; ****** NOT WORKING
GUICtrlSetBkColor( -1, $GUI_BKCOLOR_TRANSPARENT ) ; ****** NOT WORKING


GUICtrlCreateLabel("Zeittakteingabe", 20, 116, 75, 14)
GUICtrlSetBkColor( -1, $GUI_BKCOLOR_TRANSPARENT )
GUISetState () 

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            exit
    EndSelect
Wend

8)

NEWHeader1.png

Link to comment
Share on other sites

Apparently GUICtrlSetBkColor( -1, $GUI_BKCOLOR_TRANSPARENT ) is not working corectly

thank you, Valuater! that was a very good tip, to use GUICtrlSetBkColor and the problem where you comment ****** NOT WORKING is no problem. with the style code 0x00000020 in GUICtrlCreatePic the button are able to use again.

but i find an other problem, it does not work with GUICtrlCreateRadio. to get a first ready version i helped me with a separat GUICtrlCreateLabel

$radio1 = GUICtrlCreateRadio("", 20, 40, 14, 14)
GUICtrlCreateLabel("Drehung R/L und Texteingabe im Chat", 40, 40, 205, 14)
GuiCtrlSetColor(-1,0xffffff)
GUICtrlSetBkColor( -1, $GUI_BKCOLOR_TRANSPARENT )
$radio2 = GUICtrlCreateRadio("nur Drehung R/L", 20, 60, 14, 14)
GUICtrlCreateLabel("nur Drehung R/L", 40, 60, 102, 14)
GuiCtrlSetColor(-1,0xffffff)
GUICtrlSetBkColor( -1, $GUI_BKCOLOR_TRANSPARENT )
$radio3 = GUICtrlCreateRadio("nur Texteingabe im Chat", 20, 80, 14, 14)
GUICtrlCreateLabel("nur Texteingabe im Chat", 40, 80, 136, 14)
GuiCtrlSetColor(-1,0xffffff)
GUICtrlSetBkColor( -1, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetState ($radio1,$GUI_CHECKED)

but i don´t like it really, cause it is much more code.

oh, only to the explanation, i learn that everything autodidactically, as hobby... :) therefore thank you all for everything what i may learn from you :whistle:

Edited by rudika

[font="Comic Sans Ms"][center]Powered by AutoIt3http://www.wik-eric.de/zips/Synchro2.2.2-4free.zip[/center][/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...