Dephi/C++交流

好记性不如烂笔头,记录下过程中的点点滴滴!

导航

TSplitControl 的实现(三)

Posted on 2008-05-27 15:22  sunhj  阅读(260)  评论(0)    收藏  举报
var 
    SplitControl :TSplitControl;
procedure TMainForm.FormCreate(Sender: TObject);
begin
  SplitControl := TSplitControl.Create(Self);
end;

procedure TMainForm.SplitterMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  if (Button = mbLeft) and (Shift = [ssLeft]) then
    SplitControl.BeginSizing(Splitter, TreeViewPanel);
end;
procedure TMainForm.SplitterMouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin
  with SplitControl do if Sizing then ChangeSizing(X, Y);
end;
procedure TMainForm.SplitterMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  with SplitControl do if Sizing then EndSizing;
end;

procedure TMainForm.FormDestroy(Sender: TObject);
begin
  SplitControl.Free;
end;