Sign in to follow this  
Followers 0
sshrum

True transparency...icon/picture control over a picture control

6 posts in this topic

#1 ·  Posted (edited)

I have a picture control on my GUI as a background so it covers the entire GUI window.

On to this I've placed a picture and a icon control

In the picture control, I've loaded a .GIF file with transparent regions

In the icon control, I've loaded a .ICO with transparent regions

When the GIF and the ICO display, the GUI BG color is what is being displayed in the transparent regions of the image controls.

Is it possible to show the background picture in the transparent regions?

EDIT: GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) works great for labels...but not with icon or picture controls.

TIA

Edited by sshrum

Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Share this post


Link to post
Share on other sites



#include <GUIConstants.au3>

$GUI = GUICreate("Test", 80, 80, -1, -1, $WS_POPUP)
GUICtrlCreatePic(".\test.bmp", 0, 0, 80, 80)

$a = DLLCall(".\BMP2RGN.dll","int","BMP2RGN", "str", ".\test.bmp", "int", 0, "int", 0, "int", 0)
SetWindowRgn($GUI, $a[0])

GUISetState()

Sleep(5000)

Func SetWindowRgn($h_win, $rgn)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1)
EndFunc

I am not sure if this is what you are looking for ...

Instead of making the background transparent, it will make the GUI take the shape of your picture.

To make it work, the picture have to be in .bmp format and the background (of the picture) have to be black instead of transparent.

You will also need the dll to be in the script direcory, but you can move it to where you want by changing the location in the code.

This function is not by me, I took it from an old post I can't remember where ...

I wish it help you :)

You can download the dll and a test picture that work with the exemple, they're attached.

test.bmp

BMP2RGN.dll

Share this post


Link to post
Share on other sites

Unfortunately, that's not what I'm attempting to do...but a neat idea all the same.

Ultimately, I want to have a top-most picture or icon (GIF or ICO with transparancy defined) to be placed over a bottom-most picture and have the underlying picture show through the transparent regions of the top most picture/icon instead of having the transparent regions of the top-most objects showing the GUI BGCOLOR (typically solid grey).

In short...picture and icon objects with true transparency.


Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Share this post


Link to post
Share on other sites

I LOVE your idea, newb, but unfortunately that won't work for me either. I'm working with favicons, so I can't use bitmaps. Here's a screen of what exactly I mean and I think sshrum means too.

Posted Image

See how the background of the 'eBay' logo should be white, but it's greyish..?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I know this is an old post but i searched now for days and haven't found any solution. Did someone of you solved the problem?

Would be great to hear from you.

I also need to have a icon with transparency drawn over a picture (GUICtrlCreatePic). So that i can see the Picture (as a background) through the transparency region of the icon?

There could be another solution to what i need. I want a background on the top of a gui. On that background a need some 'buttons' wich the user can press. The 'buttons' should be of any size and shape so a standard button won't do it. Also the 'button' should change the color so that the user can see that he pushed the 'button'. I tried several things...

greetz

Sundance

Edited by Sundance

Share this post


Link to post
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
Sign in to follow this  
Followers 0