开发者

DrawThemeBackground to bitmap

开发者 https://www.devze.com 2023-04-12 03:51 出处:网络
I am trying to use DrawThemeBackground to draw to a bitmap in C#, but it always comes out as black. Bitmap bmp = new Bitmap(this.Width, this.Height, PixelFormat.Format32bppArgb);

I am trying to use DrawThemeBackground to draw to a bitmap in C#, but it always comes out as black.

Bitmap bmp = new Bitmap(this.Width, this.Height, PixelFormat.Format32bppArgb);
using (Graphics g = Graphics.FromImage(bmp))
{
    g.Clear(Color.Green);
    IntPtr hdc = g.GetHdc();
    DrawThemeBackground(hTheme, hdc, 0, 1, ref rect, IntPtr.Zero);
    g.ReleaseHdc(hdc);
}

It appears that DrawThemeBackground isn't looking at the background colour of the bitmap (green in this case)开发者_C百科 and is always blending with black. Am I missing something here? Is this even possible to do?

0

精彩评论

暂无评论...
验证码 换一张
取 消