。使用的()C++ MFC如何在C++ MFC应用程序中绘制Alpha透明矩形
的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.
}
如果我调用GdiplusStartup();我应该调用GdiplusShutdown吗? 我想我必须。如果我必须,它是否应该在Paint Event内? – 2010-11-03 14:16:20
GdiplusStartup应该从你的MFC应用程序的InitInstance函数一次usally调用。然后,GdiplusShutdown应该在应用程序退出时调用一次。 – Goz 2010-11-03 14:18:34