Jump to content

Not transparent .gif transparent in my GUI


Recommended Posts

Hello, ok, i create a my gui, code:

#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#NoTrayIcon

;Create GUI
$cs1_w = GUICreate("", 132, 43, -1, -1, BitOR($WS_POPUP, $WS_VISIBLE), $WS_EX_TOOLWINDOW)

$i_up = GUICtrlCreatePic(@ScriptDir & "\images\skin\up_cs1.gif", 0, 0, 0, 0, -1, $GUI_WS_EX_PARENTDRAG)
$i_map = GUICtrlCreatePic(@ScriptDir & "\images\maps\cs\de_nuke.gif", 101, 12, 30, 30)
$i_main = GUICtrlCreatePic(@ScriptDir & "\images\skin\form_main.gif", 0, 11, 0, 0)

$cs1_w_l1 = GUICtrlCreateLabel("Players: 14/31", 4, 14, 96)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$cs1_w_l2 = GUICtrlCreateLabel("Map: de_nuke", 4, 26, 96)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

GUISetState(@SW_SHOW)

WinSetOnTop($cs1_w, "", 1)

;Movement
Func left()
    $winpos = WinGetPos($cs1_w)
    WinMove($cs1_w,"",$winpos[0]-10,$winpos[1])
EndFunc

Func right()
    $winpos = WinGetPos($cs1_w)
    WinMove($cs1_w,"",$winpos[0]+10,$winpos[1])
EndFunc

Func up()
    $winpos = WinGetPos($cs1_w)
    WinMove($cs1_w,"",$winpos[0],$winpos[1]-10)
EndFunc

Func down()
    $winpos = WinGetPos($cs1_w)
    WinMove($cs1_w,"",$winpos[0],$winpos[1]+10)
EndFunc

;Save Position
Func savepos()
    $winpos = WinGetPos($cs1_w)
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\spmon", "cs1_w_x_pos", "REG_SZ", $winpos[0])
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\spmon", "cs1_w_y_pos", "REG_SZ", $winpos[1])
EndFunc

While 1
If WinActive($cs1_w) Then
    HotKeySet("{LEFT}", "left")
    HotKeySet("{RIGHT}", "right")
    HotKeySet("{UP}", "up")
    HotKeySet("{DOWN}", "down")
Else
    HotKeySet("{LEFT}")
    HotKeySet("{RIGHT}")
    HotKeySet("{UP}")
    HotKeySet("{DOWN}")
EndIf
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            savepos()
            Exit
        EndSwitch
WEnd

And now i want to create button on my GUI... ok, create image for my button:

Posted Image

This image a NOT transparent (.gif):

Posted Image

Ok, add my button in GUI after 6 line in code:

$i_b_1 = GUICtrlCreatePic(@ScriptDir & "\images\skin\b_1.gif", 123, 3, 0, 0)

Added, and now i see this:

Posted Image

But if to cut 8 line:

;$i_up = GUICtrlCreatePic(@ScriptDir & "\images\skin\up_cs1.gif", 0, 0, 0, 0, -1, $GUI_WS_EX_PARENTDRAG)

I see this:

Posted Image

Why is my button transparent? Image for button NOT transparent...

Project in attach... Please help and sorry for my bad English...

help.rar

Edited by Phantomasss
Link to comment
Share on other sites

Hello, ok, i create a my gui, code:

#include <WindowsConstants.au3>
   #include <GUIConstants.au3>
   #NoTrayIcon
   
  ;Create GUI
   $cs1_w = GUICreate("", 132, 43, -1, -1, BitOR($WS_POPUP, $WS_VISIBLE), $WS_EX_TOOLWINDOW)
   
   $i_up = GUICtrlCreatePic(@ScriptDir & "\images\skin\up_cs1.gif", 0, 0, 0, 0, -1, $GUI_WS_EX_PARENTDRAG)
   $i_map = GUICtrlCreatePic(@ScriptDir & "\images\maps\cs\de_nuke.gif", 101, 12, 30, 30)
   $i_main = GUICtrlCreatePic(@ScriptDir & "\images\skin\form_main.gif", 0, 11, 0, 0)
   
   $cs1_w_l1 = GUICtrlCreateLabel("Players: 14/31", 4, 14, 96)
   GUICtrlSetFont(-1, 8, 400, 0, "Arial")
   GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
   $cs1_w_l2 = GUICtrlCreateLabel("Map: de_nuke", 4, 26, 96)
   GUICtrlSetFont(-1, 8, 400, 0, "Arial")
   GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
   
   GUISetState(@SW_SHOW)
   
   WinSetOnTop($cs1_w, "", 1)
   
  ;Movement
   Func left()
       $winpos = WinGetPos($cs1_w)
       WinMove($cs1_w,"",$winpos[0]-10,$winpos[1])
   EndFunc
   
   Func right()
       $winpos = WinGetPos($cs1_w)
       WinMove($cs1_w,"",$winpos[0]+10,$winpos[1])
   EndFunc
   
   Func up()
       $winpos = WinGetPos($cs1_w)
       WinMove($cs1_w,"",$winpos[0],$winpos[1]-10)
   EndFunc
   
   Func down()
       $winpos = WinGetPos($cs1_w)
       WinMove($cs1_w,"",$winpos[0],$winpos[1]+10)
   EndFunc
   
  ;Save Position
   Func savepos()
       $winpos = WinGetPos($cs1_w)
       RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\spmon", "cs1_w_x_pos", "REG_SZ", $winpos[0])
       RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\spmon", "cs1_w_y_pos", "REG_SZ", $winpos[1])
   EndFunc
   
   While 1
   If WinActive($cs1_w) Then
       HotKeySet("{LEFT}", "left")
       HotKeySet("{RIGHT}", "right")
       HotKeySet("{UP}", "up")
       HotKeySet("{DOWN}", "down")
   Else
       HotKeySet("{LEFT}")
       HotKeySet("{RIGHT}")
       HotKeySet("{UP}")
       HotKeySet("{DOWN}")
   EndIf
       $nMsg = GUIGetMsg()
       Switch $nMsg
           Case $GUI_EVENT_CLOSE
               savepos()
               Exit
           EndSwitch
   WEnd

And now i want to create button on my GUI... ok, create image for my button:

Posted Image

This image a NOT transparent (.gif):

Posted Image

Ok, add my button in GUI after 6 line in code:

$i_b_1 = GUICtrlCreatePic(@ScriptDir & "\images\skin\b_1.gif", 123, 3, 0, 0)

Added, and now i see this:

Posted Image

But if to cut 8 line:

;$i_up = GUICtrlCreatePic(@ScriptDir & "\images\skin\up_cs1.gif", 0, 0, 0, 0, -1, $GUI_WS_EX_PARENTDRAG)

I see this:

Posted Image

Why is my button transparent? Image for button NOT transparent...

Project in attach... Please help and sorry for my bad English...

I don't know why, it does seem a bit strange. I edited the image and replaced the centre colours with the same colours (as far as I could tell) and saved it. Now it works ok.

post-3602-1242146586_thumb.gif

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

Maybe this last problem in this GUI:

How to add transparent button? As i understand it is necessary to create new GUI:

GUICreate("", 6, 6, $cs1_w_x_pos, $cs1_w_y_pos, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $cs1_w)

If i add this then all GUI paintet:

Posted Image

Why?

Image of button:

Posted Image

Thanks!

Link to comment
Share on other sites

Help please...

Can you post some code which we can run and which shows the problem?

Maybe if you set the style of the back image to have $WS_CLIPSIBLINGS and you create the back image after the button image it will 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

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...