Alex Poon

I tried to make transparent control on WM5 using VS2005. But I got some problem.

I made a custom control (round shape button which have mouseover effect) and overrides OnPaintBackground to do nothing to prevent the control to draw the control background and overrides OnPaint to paint a round shape graphic which used the setColorKey to set transparent color and  paint it on the control.

I put this custom control on a window form which user can change the form background image or photo at any time. The transparent is working fine.

BUT, when there is any messagebox popup which can overlay the custom control button, the trasparent part of the control will not redraw and I still saw the "remaining" messagebox on the transparent region even I close the message box. How can I fix it

And one more question is that how can I check is user clicked on the transparent region or not As I don't want the button to fire the click event when user is clicked outside or the transparented edge of the round shape (circle) button.

 

 

 



Re: .NET Compact Framework Transparent control

AlexY

You can try the techinque Alex suggested in this white paper:

http://www.opennetcf.com/Default.aspx tabid=130





Re: .NET Compact Framework Transparent control

Alex Poon

Thanks. Seems useful. I will take a try. But seems hard to understand its shape class. See if I can build it as a class library and use it in my custom control or not.





Re: .NET Compact Framework Transparent control

Alex Poon

I got another problem. I tried the OpenNETCF shape class to reshape a picturebox. But it has some problem or limited.

(1) It only support 8 or 14 bpp bitmap
(2) Only white color (RGB 255, 255, 255) can be removed as transparent. Does any one know how to modify the class tothe support a range of color Actually, I don't understand the code in that class at all, so I am not able to make any changes on it.
(3) It does not support stretching. I designed in 320*240 screen. But when I used it in 640*480 screen, it can not auto enlarge and it also has a problem when I set the picturebox to stretch mode.
(4) It still has some white edge after reshape the control. Is this a bug




Re: .NET Compact Framework Transparent control

Alex Poon

Can anyone help me