Q&A

  • [답글]패널을 투명하게!!
저두 여러 동호회 사이트에 질문해서
소스를 얻었습니다...
혹시 도움이 될만할런지!!

procedure TForm1.Button1Click(Sender: TObject);
begin
ClearPanel(TPanel(panel1));//전달인수를 폼으로 하면 폼또한 투명효과를 줄 수 있다.
end;

procedure TForm1.ClearPanel(var panel : TPanel);
var  I : Integer;
    FullRgn, ClientRgn, ControlRgn : THandle;
    Margin, MarginX, MarginY, X, Y : Integer;
begin
    Margin := (panel.Width - panel.ClientWidth) div 2;
    FullRgn := CreateRectRgn(0, 0, panel.Width, panel.Height);
    MarginX := Margin;
    MarginY := panel.Height - panel.ClientHeight - Margin;
    ClientRgn := CreateRectRgn(MarginX, MarginY, MarginX + panel.ClientWidth,
                                                 MarginY + panel.ClientHeight);
    CombineRgn(FullRgn, FullRgn, ClientRgn, RGN_DIFF);
    for I:=0 to panel.ControlCount-1 do begin
        X := MarginX + panel.Controls[I].Left;
        Y := MarginY + panel.Controls[I].Top;
        ControlRgn := CreateRectRgn(X, Y, X + panel.Controls[I].Width,
                                          Y + panel.Controls[I].Height);
        CombineRgn(FullRgn, FullRgn, ControlRgn, RGN_OR);
    end;
    SetWindowRgn(panel.Handle, FullRgn, True);
end;
오늘도 즐코!!!
0  COMMENTS