阅读背景:

利用图版背景颜色将PANEL透明化

来源:互联网 
     //--------------------  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 透明

    //*



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: