zoukankan      html  css  js  c++  java
  • Delphi中拖动的方式来移动TPageControl的Tab

    procedure TMainForm.PageControl1MouseDown(Sender: TObject;
      Button: TMouseButton; Shift: TShiftState; X, Y: Integer) ;
    begin
      PageControl1.BeginDrag(False) ;
    end;

    procedure TMainForm.PageControl1DragDrop(Sender, Source: TObject; X,
      Y: Integer) ;
    const
      TCM_GETITEMRECT = $130A;
    var
      TabRect: TRect;
      j: Integer;
    begin
      if (Sender is TPageControl) then
      for j := 0 to PageControl1.PageCount - 1 do
      begin
        PageControl1.Perform(TCM_GETITEMRECT, j, LParam(@TabRect)) ;
        if PtInRect(TabRect, Point(X, Y)) then
        begin
          if PageControl1.ActivePage.PageIndex <> j then
            PageControl1.ActivePage.PageIndex := j;
          Exit;
        end;
      end;
    end;

    procedure TMainForm.PageControl1DragOver(Sender, Source: TObject; X,
      Y: Integer; State: TDragState; var Accept: Boolean) ;
    begin
      if (Sender is TPageControl) then Accept := True;
    end;

  • 相关阅读:
    CF261E Maxim and Calculator
    USACO Section 2.1
    码工新人的成长升职之路~
    Skip level 1 on 1
    有效利用1 on 1
    [职场感言] 入职一年总结
    职场新人建议
    L1 正则为什么会使参数偏向稀疏
    Inception网络
    ResNet
  • 原文地址:https://www.cnblogs.com/yzryc/p/6329466.html
Copyright © 2011-2022 走看看