Wednesday, January 30, 2008

Paint Dock Frame


procedure TDockTree.PaintDockFrame(Canvas: TCanvas; Control: TControl; const ARect: TRect);

procedure DrawCloseButton(Left, Top: Integer);
begin
DrawFrameControl(Canvas.Handle, Rect(Left, Top, Left+FGrabberSize-2,
Top+FGrabberSize-2), DFC_CAPTION, DFCS_CAPTIONCLOSE);
end;

procedure DrawGrabberLine(Left, Top, Right, Bottom: Integer);
begin
with Canvas do
begin
Pen.Color := clBtnHighlight;
MoveTo(Right, Top);
LineTo(Left, Top);
LineTo(Left, Bottom);
Pen.Color := clBtnShadow;
LineTo(Right, Bottom);
LineTo(Right, Top-1);
end;
end;

begin
with ARect do
if FDockSite.Align in [alTop, alBottom] then
begin
DrawCloseButton(Left+1, Top+1);
DrawGrabberLine(Left+3, Top+FGrabberSize+1, Left+5, Bottom-2);
DrawGrabberLine(Left+6, Top+FGrabberSize+1, Left+8, Bottom-2);
end
else
begin
DrawCloseButton(Right-FGrabberSize+1, Top+1);
DrawGrabberLine(Left+2, Top+3, Right-FGrabberSize-2, Top+5);
DrawGrabberLine(Left+2, Top+6, Right-FGrabberSize-2, Top+8);
end;
end;

No comments: