在使用C++ MFC应用程序时,使用(CPaintDC dc(this);
)的dc
如何绘制一个带有可调节alpha透明度的矩形(LPRECT
)?
以下是需要转换为C ++的示例c#代码
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Color color = Color.FromArgb(75,Color.Red); //sets color Red with 75% alpha transparency
Rectangle rectangle = new Rectangle(100,100,400,400);
g.FillRectangle(new SolidBrush(color), rectangle); //draws the rectangle with the color set.
}