//-------------------- panel 透明
//*
HRGN hRgn = NULL;
Graphics::TBitmap* MemoryBitmap = new Graphics::TBitmap;
MemoryBitmap->Assign(Image7->Picture->Graphic);
TColor ttt=MemoryBitmap->Canvas->Pixels[11][5];// MemoryBitmap->ca
for(int n=0; n<pnl_left->Width; n++)
{
for (int j=0;j<pnl_left->Height; j++)
{
TRect Rect;
Rect.top=j;
Rect.left=n;
Rect.bottom=Rect.top+1;
Rect.right=Rect.left+1;
if ( MemoryBitmap->Canvas->Pixels[0][0]!=MemoryBitmap->Canvas->Pixels[n][j])// MemoryBitmap->ca)
{
HRGN hRgn1 = CreateRectRgnIndirect(
&Rect);
if (hRgn == NULL)
hRgn = hRgn1;
else {
CombineRgn(hRgn, hRgn, hRgn1,
RGN_OR);
DeleteObject(hRgn1);
}
}
}
}
SetWindowRgn(pnl_left->Handle, hRgn, TRUE);
DeleteObject(hRgn);
delete MemoryBitmap;
利用图版背景颜色将PANEL透明化
最新推荐文章于 2024-06-02 17:47:14 发布