How to add a layer to a menuitem image

Posted by alexander on Stack Overflow See other posts from Stack Overflow or by alexander
Published on 2010-06-08T10:17:33Z Indexed on 2010/06/08 10:22 UTC
Read the original article Hit count: 236

Filed under:
|

I have a menuitem with an image. I want to add half-transparent layer to that image.

    private void menuItem1_Paint(object sender, PaintEventArgs e)
    {
        using (SolidBrush brush = new SolidBrush(Color.FromArgb(128, SystemColors.ActiveCaption)))
        {
            e.Graphics.FillRectangle(brush, e.ClipRectangle);
        }
    }

My problem is = I don't know clientrectangle of that image. e.ClipRectangle - it fills whole menuitem. I want to fill only image. How ?

Is there another way, maybe ?

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms