Jump to content

Window Transparency Gradient?


dbzfanatic
 Share

Recommended Posts

I'm looking for a function or combination of functions to make part of window transparent. What I want is for the center to be completely transparent and the edges solid. I can set the whole window to transparent which is a good start but is there a way to set different transparencies at different positions on the window? I have this so far but it only changes the whole window. Could anyone help or point me in the right direction (other than using a custom image and $WS_EX_LAYERED)?

Link to comment
Share on other sites

The best way I can think to tell you to do this is:

1/ create a loop that creates how many ever GUIs you need to make a smooth looking transition.

2/ set each of those windows to a different transparent level

3/ create a final GUI that I guess would have your main controls and set that window to completely transparent and set it on top of the bunch of GUIs you created to simulate a gradient look.

So it may look something like this, off the top of my head so play with it, the math in the GUI window settings is prob. wrong as well so check that:

$j = 300
For $i = 255 To 0 Step - 1
   $trans = guicreate("Title", 0, 300, $j, 300);set the style to popup, no borders...I don't remember that right now...look it up
   WinSetTrans($trans , "", $i)
   guisetstate()
   $j += 2
next
$j = 300
For $i = 0 to 255
   $trans = guicreate("Title", 255, 300, $j, 300);set the style to popup, no borders...I don't remember that right now...look it up
   WinSetTrans($trans , "", $i)
   guisetstate()
   $j += 2
next
;Now set the main GUI that will sit on top and hold your controls and labels and be totally transparent so you can see the gradient style
guicreate("On Top")
winsettrans("On Top", "", 0)
guisetstate()

You are also going to want to make sure none of those GUIs set tray icons or toolbars...don't remember how to do that right now either.

EDIT: You can do this from top to bottom, left to right, I can't see how you can get it on all four sides.

EDIT: Actually, you might be able to get it on all four sides like you want it, just take what I showed you and then layer two more loops going from up->down BEFORE layering the final GUI on top. This is just a theory. Even if this does work, it is a WHOLE lot of GUIs!!!!! Is it really worth it...if this is the only way?

Edited by Champak
Link to comment
Share on other sites

Thanks, thought about doing that but I was hoping to have just a single GUI (for obvious reasons) thanks for the effort and if this is the only way or not I'll post with a resolution.

Link to comment
Share on other sites

I don't really know what you are saying, if it is a question or not, but try this.

Global $array[255]
$j = 300
For $i = 0 to 255 - 1
   $array[$i] = guicreate("Title", 2, 300, $j, 300,$WS_POPUP+$WS_DISABLED,$WS_EX_TOOLWINDOW+$WS_EX_TOPMOST)
   WinSetTrans($array[$i], "", $i)
   guisetstate()
   $j += 1
next

$GUICompDir = GuiCreate("Top GUI", 255, 300, 298, 271, -1, $WS_EX_LAYERED+$WS_EX_TOPMOST)
   $TLPic = GUICtrlCreatePic("Transparent.gif", 0, 0, 300, 300)
   GUICtrlSetState(-1, $GUI_DISABLE)
   GUICtrlCreateLabel("BG", 2, 17, 145, 50)
   GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlCreateButton("Button", 2, 50, 50, 50)
GUISetState()


While 1
    Sleep(100)
WEnd

Make a transparent image. And you just have to mess around with Child GUI settings to make everything appear and disappear at the same time.

Link to comment
Share on other sites

I was hoping to do it without using multiple GUIs or custom transparent images. I stated that in my first post but if I have no choice...

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