Copying images from toolbar image list to system menu

  • Thread starter Thread starter Will Pittenger
  • Start date Start date
W

Will Pittenger

I have a program where I used Win32 calls to add items to my form's system
menu. Now I am attempting to have those items use the same icon that the
corresponding toolbar button uses. I thought that I could just access the
image on the fly and send it to Windows. Trouble is that results in an
image with dark blue where the image is transparent. (The menu's background
is the standard BTNFACE color.) My code is below. All need is a HBITMAP.
Windows is definitely insisting on a bitmap rather than an icon. Could
someone tell me what is wrong? Do I need to paint the image somewhere? I
would rather just copy it.

((System.Drawing.Bitmap)ilToolbarSmall.Images[iUncheckedIconIndex]).GetHbitm
ap()
 
After some careful experimenting and examination of some zoomed screen
captures, I concluded that white was replaced with RGB(192, 192, 192) and
RGB(192, 192, 192) with RGB(0, 0, 192). I tried code to manually copy the
images to a new bitmap with a graphics object created from that bitmap.
That did not change anything. So I thought perhaps I could use a flood fill
to force the background to either grey or white. I had to use more Win32
code for that as I could not find a .NET flood fill. At this point, it
looks like I need to find a solution in the Win32 group. However, if anyone
here has a suggestion, I will continue to track this topic.
 
Back
Top