How to make a rectangle in Graphics in a transparent colour?

后端 未结 2 893
梦如初夏
梦如初夏 2021-02-18 15:40

I\'m trying to paint a rectangle on my application in a red shade but I need to make it sort of transparent so that the component under it will still show. However I still want

2条回答
  •  走了就别回头了
    2021-02-18 16:36

    int alpha = 127; // 50% transparent
    Color myColour = new Color(255, value, value, alpha);
    

    See the Color constructors that take 4 arguments (of either int or float) for further details.

提交回复
热议问题