delphi 在 DragDrop 的时候,滚动 TreeView

在 DragDrop 的时候,滚动 TreeView

当高度不够的时候

 
 
procedure TForm1.TreeView1DragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
  if (y < 15) then
   {On the upper edge - should scroll up }
     SendMessage(TreeView1.Handle, WM_VSCROLL, SB_LINEUP, 0)
  else if (TreeView1.Height - y < 15) then
   { On the lower edge - should scroll down }
      SendMessage(TreeView1.Handle, WM_VSCROLL, SB_LINEDOWN, 0);
 
 
 
    Accept := Source = Sender;
    if not Accept then exit;
end;




posted @ 2014-08-01 10:51  XE2011  阅读(284)  评论(0编辑  收藏  举报