Transparent part is not painted

  • Thread starter Thread starter ORC
  • Start date Start date
O

ORC

Hi,

I have made a custom control - a button that is able to show an image. The
image can have a transparent background and is sometimes placed halfway on
top of another control.

Following is part of the code that is placed in the 'OnPaint' event:

ImageAttributes imageAttr = new ImageAttributes();
imageAttr.SetColorKey( bitmapTransparentColor, bitmapTransparentColor);

e.Graphics.DrawImage(image, imgRect, 0, 0, image.Width, image.Height,
GraphicsUnit.Pixel, imageAttr);


But the part that is transparent isn't updated / painted - what have I
missed?.

Thanks - your respons is highly appreciated
Ole
 
CE doesn't support transparent windows so all that happens is it doesn't
draw the areas you mask off with the colorkey. Therefore unless your
OnPaintBackground fills the background of the control, you will end up with
an area which doesn't redraw.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
 
Thanks for your prompt reply!

Is it possible to get an image of a specified rectangle from the windows
beneath?

Thanks
Ole
 
Back
Top