如何制作透明的panel

解决方案 »

  1.   

    没听讲过panel也可以透明的。
      

  2.   

    procedure TForm1.FormCreate(Sender: TObject);
    var
      FullRgn, ClientRgn, ButtonRgn: THandle;
      Margin, X, Y: Integer;
    begin
    with Panel1 do
      begin
          Margin := (Width - ClientWidth) div 2;
          FullRgn := CreateRectRgn(0, 0, Width, Height);
          X := Margin;
          Y := Height - ClientHeight - Margin;
          ClientRgn := CreateRectRgn(X, Y, X + ClientWidth, Y + ClientHeight);
          CombineRgn(FullRgn, FullRgn, ClientRgn, RGN_DIFF);
          X := X + Button1.Left;
          Y := Y + Button1.Top;
          ButtonRgn := CreateRectRgn(X, Y, X + Button1.Width, Y + Button1.Height);
          CombineRgn(FullRgn, FullRgn, ButtonRgn, RGN_OR);
          SetWindowRgn(Handle, FullRgn, True);
      end;
    end;
      

  3.   

    将button以外的区域剪裁掉,你要得是不是这种效果?
      

  4.   

    把panel的parentcolor设为true,然后bevelinner,bevelouter设为bvnone也能达到如此效果啊
      

  5.   

    还得将panel的其他控件的visable设为false
      

  6.   

    阿德的办法让Panel都不见了,连Caption。好象不是楼主本意吧?
      

  7.   

    和panel1.Visible:=false;的方法一模一样。