绘制低透明度一个填充矩形 [英] Draw a Fill Rectangle with low opacity
本文介绍了绘制低透明度一个填充矩形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个在C#中language.I Windows窗体应用程序的图片一个PictureBox想picturebox.but的某个位置我还需要看到图像的图像box.how可我画这个矩形的低透明度,看图片框
I a have a PictureBox with a picture in a Windows Form application in C# language.I want draw a FillRectangle in some location of picturebox.but i also need to see picture of picture box.how can i draw this rectangle with low opacity to see image of picturebox?
推荐答案
你的意思的形象:
using (Graphics g = Graphics.FromImage(pb.Image))
{
using(Brush brush = new SolidBrush(your_color))
{
g.FillRectangle(brush , x, y, width, height);
}
}
也可以使用
or you can use
Brush brush = new SolidBrush(Color.FromArgb(alpha, red, green, blue))
其中的字母的从0到255,所以128的阿尔法值会给你50%
opactity。
where alpha goes from 0 to 255, so a value of 128 for your alpha will give you 50% opactity.
这篇关于绘制低透明度一个填充矩形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文