Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - CommandBars.Icons.LoadBitmap / Mask
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CommandBars.Icons.LoadBitmap / Mask

 Post Reply Post Reply
Author
Message
indices View Drop Down
Groupie
Groupie


Joined: 21 September 2007
Location: India
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote indices Quote  Post ReplyReply Direct Link To This Post Topic: CommandBars.Icons.LoadBitmap / Mask
    Posted: 30 October 2007 at 1:14pm
Does the CommandBars.Icons.LoadBitmap  method apply a mask on the loadded bitmap?
 
I am loading several BMP files with background color however when I use the code below to draw the icon, the background is missing.
 
Set Icon = CommandBars.Icons.GetImage(Item.ID, 32)
Icon.Draw HDC, X + 5, Y + 5, 32, 32, xtpImageNormal
 

       
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 30 October 2007 at 1:34pm
Hi,
 
Topleft pixel in bitmap used for transparent color
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
indices View Drop Down
Groupie
Groupie


Joined: 21 September 2007
Location: India
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote indices Quote  Post ReplyReply Direct Link To This Post Posted: 30 October 2007 at 3:53pm
Hi,
Is there any way I can force it not to apply the mask?
These bmps are non-transparent and being loaded into a gallery.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 31 October 2007 at 2:14am
Hello,
 
Set MaskColor to some value before you load them.
 
CommandBars.Icons.MaskColor = vbRed
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Krog View Drop Down
Groupie
Groupie


Joined: 06 February 2008
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote Krog Quote  Post ReplyReply Direct Link To This Post Posted: 12 December 2009 at 12:20am
How can I load my bitmaps without using any MaskColor at all? I don't want to loose any color on the bitmap.

I did not find a property like UseMaskColor on the ImageManager.Icons.

Thanks in advance.
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows XP SP2
Language: Visual Basic 6 SP6
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 14 December 2009 at 6:20am
Hi,
 
Just set it to some value > 0xFFFFFF
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Krog View Drop Down
Groupie
Groupie


Joined: 06 February 2008
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote Krog Quote  Post ReplyReply Direct Link To This Post Posted: 29 December 2009 at 9:57pm
Hi Oleg!

I tested it and it is the same as if the value does not have the 0xff000000 part.

eg. 0x1000000 gives me equal results as 0x00

Also with pictures that does have less than 24 bits per pixel (not RGB), as some GIFs, the mask applies to black (0x00) color.

My code is like this:

ImageManager1.Icons.MaskColor = GetRGBColor(UserControl.BackColor) '&H1000000 '&H1000001 'False '0
ImageManager1.Icons.AddBitmap Img.Handle, 100 + Index, xtpImageNormal, False
Set imImage = ImageManager1.Icons.GetImage(100 + Index, 0)

Happy Holidays!
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows XP SP2
Language: Visual Basic 6 SP6
Back to Top
shipwreck View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 April 2008
Location: United States
Status: Offline
Points: 308
Post Options Post Options   Thanks (0) Thanks(0)   Quote shipwreck Quote  Post ReplyReply Direct Link To This Post Posted: 30 December 2009 at 3:06am
Hello Krog and indice.

Typically, I prefer to use .png files as icons rather than the usual bitmap because they support higher color bit and built in transparancies.
If you would like to see an example code let me know. ;]

Back to Top
Krog View Drop Down
Groupie
Groupie


Joined: 06 February 2008
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote Krog Quote  Post ReplyReply Direct Link To This Post Posted: 30 December 2009 at 4:30am
Hi Donald!

I sometimes use png files for icons too, when the icon has only one image size.

But in this case I am using the ImageManager as a intermediate control to show larger images on markup controls. And the user can select any image from its computer.

And in this case the masking is not desired.

Thanks!
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows XP SP2
Language: Visual Basic 6 SP6
Back to Top
shipwreck View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 April 2008
Location: United States
Status: Offline
Points: 308
Post Options Post Options   Thanks (0) Thanks(0)   Quote shipwreck Quote  Post ReplyReply Direct Link To This Post Posted: 30 December 2009 at 6:48am
Different sizes should be a problem with the seticonsize method. But that too is a great work around. Thanks
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.109 seconds.