Sign in to follow this  
Followers 0
Fantastic

Using Icons.au3 and more

5 posts in this topic

#1 ·  Posted (edited)

I am using Yashied Icons.au3 for merging 2 icons and then displaying.

The problem is that after merging 2 icons I get black background.

Is there any workaround getting transparent background ?

Please note that I need transparent background and not colored.

And here a sample code ( you will need Yashied Icons.au3)

#include-once
#include <GUIConstantsEx.au3>
#include 'icons.au3'

GUICreate('Test', 200, 200, -1, -1)
GUISetBkColor(0xE0FFFF)
$pic = GUICtrlCreatePic('', 10, 10, 64, 64)
$icon1 = _Icons_Icon_Extract(@SystemDir & '\shell32.dll', 4, 48, 48)
$icon2 = _Icons_Icon_Extract(@SystemDir & '\shell32.dll', 100, 32, 32)
$hIcon = _Icons_Icon_Merge(0, $icon1, $icon2, 16, 16)
$hBitmap = _Icons_Bitmap_CreateFromIcon($hIcon)
_SetHImage($pic, $hBitmap)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DestroyIcon($hIcon)

GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Any help will be appreciated.

It's solved, look at post #5

Edited by Fantastic

Share this post


Link to post
Share on other sites



Share this post


Link to post
Share on other sites

_Icons_Icon_Merge() function does not support transparency, but you can do so:

$hIcon = _Icons_Icon_Merge(0xE0FFFF, $icon1, $icon2, 16, 16)

If it does not fit, you can read here or here.

Is there any way editing your _Icons_Icon_Merge() function to support transparency like it's done here.

I'll have a look at those links of course and thank you.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

For icons - No.

Thanks again Yashield. After playing with your first example I just did what I wanted.

Next I'll try with your UDF if I can have the same effect.

Code will be posted here.

Slyghtly modded code but works (again you will need Icons.au3)

#Include 'Icons.au3'

GUICreate('MyGUI', 350, 250)
GUISetBkColor(0xE0FFFF)
$sRegPath = "HKLM\SOFTWARE\AutoIt v3\AutoIt"
If StringInStr("X64IA64", @OSArch) Then $sRegPath = StringReplace($sRegPath, "SOFTWARE", "SOFTWARE\Wow6432Node")

$TestImage = RegRead($sRegPath, "InstallDir") & "\Examples\GUI\msoobe.jpg"

$Pic1 = GUICtrlCreatePic($TestImage, 30, 0, 350, 250)
$hPic1 = GUICtrlGetHandle($Pic1)
$Pic2 = GUICtrlCreatePic('', 40, 40, 48, 48)
$hPic2 = GUICtrlGetHandle(-1)
GUISetState()


; Set Icon
$hDC = _WinAPI_GetDC($hPic2)
$hMemDC = _WinAPI_CreateCompatibleDC($hDC)
$hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, 48, 48)
_WinAPI_SelectObject($hMemDC, $hBitmap)
$hIcon = _Icons_Icon_Extract(@SystemDir & '\shell32.dll', 130, 48, 48)
$hIcon2 = _Icons_Icon_Extract(@SystemDir & '\shell32.dll', 4, 48, 48)
_WinAPI_DrawIconEx($hMemDC, 0, 0, $hIcon, 48, 48, 0, 0, 3)
_WinAPI_DrawIconEx($hMemDC, 16, 16, $hIcon2, 32, 32, 0, 0, 3)
_WinAPI_ReleaseDC($hPic2, $hDC)
_WinAPI_DeleteDC($hMemDC)
_SetHImage($Pic2, $hBitmap)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DestroyIcon($hIcon)
_WinAPI_DestroyIcon($hIcon2)

Do
Until GUIGetMsg() = -3

GUIDelete()

/Solved

Edited by Fantastic

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