GuidoBartels
asked on
Create a transpartent icon with hdc
Here i create a icon, i have to set the background to the color white, otherwise it is black!
How can i set bytes or a transparent mode?
1. create an icon with an image hdc
2. set background white
The source code:
Set m_cIcon_Form = New clsMemDC
Call m_cIcon_Form.pCreate(16, 16)
'**** weißen Hintergrund setzen ****
Call ExtFloodFill(m_cIcon_Form. HDC, 0, 0, 255, 0)
Call Draw_Picture(cst_Norm_16, _
m_cIcon_Form, _
par_Action, _
par_IconName, _
16, _
par_Enabled, _
par_TotalTag)
Call GetBitmapBits(m_cIcon_Form .hBmp, bufsize, bitArray(0))
' For i = 0 To bufSize
' maskArray(i) = 0
' Next i
lkl_IconSmall_hWnd = CreateIcon(par_Form.hwnd, 16, 16, 1, fc_ColorDepth, maskArray(0), bitArray(0))
Call SendMessageLong(par_Form.h wnd, WM_SETICON, ICON_SMALL, lkl_IconSmall_hWnd)
Thanks
How can i set bytes or a transparent mode?
1. create an icon with an image hdc
2. set background white
The source code:
Set m_cIcon_Form = New clsMemDC
Call m_cIcon_Form.pCreate(16, 16)
'**** weißen Hintergrund setzen ****
Call ExtFloodFill(m_cIcon_Form.
Call Draw_Picture(cst_Norm_16, _
m_cIcon_Form, _
par_Action, _
par_IconName, _
16, _
par_Enabled, _
par_TotalTag)
Call GetBitmapBits(m_cIcon_Form
' For i = 0 To bufSize
' maskArray(i) = 0
' Next i
lkl_IconSmall_hWnd = CreateIcon(par_Form.hwnd, 16, 16, 1, fc_ColorDepth, maskArray(0), bitArray(0))
Call SendMessageLong(par_Form.h
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi
The mthod I posted is the easiest way to create icon from bmp picture. I donno what clsMemDC class,Draw_Picture function and other variables are. For API way of creating icon see http://www.vb-helper.com/HowTo/bmp2ico.zip
The mthod I posted is the easiest way to create icon from bmp picture. I donno what clsMemDC class,Draw_Picture function and other variables are. For API way of creating icon see http://www.vb-helper.com/HowTo/bmp2ico.zip
ASKER
Ok, i check this code out,
am on holiday now, give you an answer later.
Guido
am on holiday now, give you an answer later.
Guido
ASKER
but sorry, i don't want to use an ImageList and a PictureBox,
i think my question is clear!
I have a build painted Picture in a hdc and i want it transparent in the forms icon!
Guido