请问这样是数据结构错误了吗?
有谁可以帮我解答一下可能出现的情况么?
位图我是这样创建的
IntPtr TempHdc = GetDC(Hwnd);
Hdc = CreateCompatibleDC(TempHdc);
ReleaseDC(Hwnd, TempHdc);
//创建窗口
BITMAPINFO BMI = new BITMAPINFO();
BMI.bmiHeader.biSize = 40;
BMI.bmiHeader.biWidth = Size .cx ;
BMI.bmiHeader.biHeight = Size.cy;
BMI.bmiHeader.biPlanes = 1;
BMI.bmiHeader.biBitCount = 32;
BMI.bmiHeader.biSizeImage = BMI.bmiHeader.biWidth * BMI.bmiHeader.biHeight * 32 / 8;
hDIB = CreateDIBSection(Hdc, ref BMI,0,0,0,0);
SelectObject(Hdc, hDIB);
这样刷新的
Point TempPoint = new Point(0, 0);
BLENDFUNCTION TempBlend = new BLENDFUNCTION();
TempBlend.AlphaFormat = 1;
TempBlend.BlendFlags = 0;
TempBlend.BlendOp = 0;
TempBlend.SourceConstantAlpha = 255;
bool a = UpdateLayeredWindow(Hwnd, 0, ref Point, ref Size, Hdc, ref TempPoint, 0, ref TempBlend, 2);
其中申明是
struct BITMAPINFO
{
public BITMAPINFOHEADER bmiHeader;
public RGBQUAD bmiColors;
}
struct RGBQUAD
{
public byte rgbBlue;
public byte rgbGreen;
public byte rgbRed;
public byte rgbReserved;
}
struct BITMAPINFOHEADER
{
public uint biSize;
public int biWidth;
public int biHeight;
public short biPlanes;
public short biBitCount;
public int biCompression;
public int biSizeImage;
public int biXPelsPerMeter;
public int biYPelsPerMeter;
public int biClrUsed;
public int biClrImportant;
}
public struct BLENDFUNCTION
{
public byte BlendOp;
public byte BlendFlags;
public byte SourceConstantAlpha;
public byte AlphaFormat;
}