。使用的()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