In my mobile project, I want to fill a rectangle with semi transparent color. Through documents, I learn that I can create solid brush with color.fromargb(). But the problem is that I can just pass three parameter in the color.fromargb(Red, Green, Blue) instead of 4 params (alpha, red, green, blue). So how can I fix it? I'm working on compact framework 2.0. Thanks in advance.
C# – Compact Framework: Fill Rectangle with solidbrush problem
ccompact-framework
Best Answer
The compact framework supports an overload taking just one Int32 parameter representing a 32-bit ARGB value. From that article:
So if you know your R, G and B values as bytes, you should be able to create the value you want from that. Something like:
... and as per @Andrew Cash's comment below, you could left shift an alpha value by 24 if you want to adjust the transparency.
That code's untested, but you get the idea.