亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? magnetunit.pas

?? 這是一個有 BUG 的磁性窗體的組件/單元
?? PAS
?? 第 1 頁 / 共 2 頁
字號:
{: (C) Copyright 2003 - All rights reserved.
    Company: BCP Software, www.bcp-software.nl
    Author:  Marco Wobben, marco@wobben.com }
unit MagnetUnit;

{ To do

  - If snapped to a screen edge, the resizing of the form using the opposite
    border doesn't snap anymore.
  - How does this work in a MDI application. The mainform's edge may not be
    considering it's border.
  - For multimonitor it now switches to snapmode 'near'. This should only be the
    case for the aligning monitor borders and not for the outermost borders.

  History

  ** 18 September 2003 **
    Fix:
      Thanks to George Boudouris.
    Behaviour:
      Snapping Magnet1 to M2 clustered ok.
      Snapping this new cluster from M1 to M3 didn't cluster M3...
    Routines Changed:
      ClusterSnapList
}

interface

{ $ DEFINE CODESITE}

uses
  Forms, Messages, Windows, Classes, Controls;

type
  TSnapOption = (soInScreen, soMagnet, soInMainForm);
  TSnapOptions = set of TSnapOption;

  TSnapBorder = (sbInner, sbOuter, sbNear);

  TMagnet = class(TComponent)
  private
    FActive: boolean;
    FClientInstance,
      FPrevClientProc: TFarProc;
    FRange: integer;
    FSnapOptions: TSnapOptions;
    FDragStart: TRect;
    FDragging: Boolean;
    FCluster: TList;
    FSnapList: TList;
    FEnableClustering: Boolean;
    FAutoSnap: boolean;
    FClusterSnapping: Boolean;
    FImmediateCluster: boolean;
    FOldArea: TRect;
    FGroupIndex: integer;
    FClusterIndex: integer;
    procedure ClientWndProc(var Message: TMessage);
    procedure SetActive(const Value: boolean);
    procedure SetRange(const Value: integer);
    procedure SetSnapOptions(const Value: TSnapOptions);
    function SnapToRect(var aLeft, aTop: integer; const aWidth, aHeight:
      integer;
      aRect: TRect; aBorder: TSnapBorder): boolean;
    function GetInCluster: Boolean;
    procedure SetEnableClustering(const Value: Boolean);
    procedure UnCluster;
    procedure ReCluster(NewCluster: TList);
    procedure SetAutoSnap(const Value: boolean);
    procedure SetClusterSnapping(const Value: Boolean);
    procedure ClusterSnapList;
    procedure AdjustCluster(Delta: TPoint);
    procedure SetImmediateCluster(const Value: boolean);
    procedure SetGroupIndex(const Value: integer);
    procedure SetClusterIndex(const Value: integer);
  protected
    function Form: TCustomForm;

    function Area: TRect;
    function Center: TPoint;

    procedure WindowPosChanging(var aPos: TPoint; const W, H: integer; Sizing: Boolean = False); virtual;
    procedure WindowSizeChanging(var aRect: TRect); virtual;
    procedure ApplyDeltaPos(aDelta: TPoint);

    procedure AppendCluster(aCluster: TList);
    procedure RemoveFromCluster(aMagnet: TMagnet);
    property Cluster: TList read FCluster;
  public
    constructor Create(aOwner: TComponent); override;
    destructor Destroy; override;

    {: Returns true if this is the magnet being dragged by a mouse cursor. }
    property Dragging: Boolean read FDragging;
    {: Returns true if this magnet is part of a cluster. }
    property InCluster: Boolean read GetInCluster;

  published
    {: Activate the magnet by setting Active to true. }
    property Active: boolean read FActive write SetActive default false;
    {: This will enable the magnet to snap to objects specified in the
       SnapOptions unless CTRL is pressed. If set to false it requires CTRL
       to be pressed to enable snapping. }
    property AutoSnap: boolean read FAutoSnap write SetAutoSnap default true;
    {: The groupindex is used to let all magnets with the same groupindex
       respond to each other. }
    property GroupIndex: integer read FGroupIndex write SetGroupIndex default 0;
    {: The clusterindex is a number which if clustering is enabled only works
       on magnets with the same clusterindex. }
    property ClusterIndex: integer read FClusterIndex write SetClusterIndex default 0;
    {: The distance to other objects at which this object will snap. }
    property Range: integer read FRange write SetRange default 15;
    {: Specifies at which objects this magnet will snap.
       soInScreen: snap on the screen edge and make sure the magnet remains inside.
       soMagnet: snap to other magnets.
       soInMainForm: similar to soInScreen, but in this case the application mainform sets the edge.
         (soInMainForm allows the magnet to leave the mainform if the mainform is dragged) }
    property SnapOptions: TSnapOptions read FSnapOptions write SetSnapOptions
      default [soInScreen, soMagnet];
    {: Set this to true to maintain the snapped magnets in a cluster while this
       magnet (or other) is being dragged. }
    property EnableClustering: Boolean read FEnableClustering write
      SetEnableClustering default true;
    {: ClusterSnapping exends the snapping behaviour accross all magnet edges in
       the cluster. }
    property ClusterSnapping: Boolean read FClusterSnapping write
      SetClusterSnapping default true;
    {: This option is default false, once set to true the snapping automatically
       clusters the magnets snapped to and does not wait until snapping is
       completed by releasing the mouse. }
    property ImmediateCluster: boolean read FImmediateCluster
      write SetImmediateCluster default false;
  end;

{: This grows or shrinks the rectangle on all sides with the specified number.
   Passing (5,5,10,10) and 1 will result in (4,4,11,11)
   Passing (5,5,10,10) and -1 will result in (6,6,9,9) }
function GrowRect(aRect: TRect; Grow: integer): TRect;
{: This function returns the surface in pixels. }
function RectArea(aRect: TRect): integer;
{: Returns true if the rectangles are aligned
  (meaning not overlapping and not a pixel space in between) }
function RectAligned(R1, R2: TRect): boolean;
{: Returns true if rectangles are overlapping and false if not. }
function RectOverlap(R1, R2: TRect): boolean;

{: Return the magnet instance in the owner component list or return nil if
   not found. }
function FindMagnet(aOwner: TComponent): TMagnet;
{: Return the magnet instance in the owner component list or returns a new
   instance if not found. }
function GetMagnet(aOwner: TComponent): TMagnet;

{: Sets the autosnap property of all magnets with the specified GroupIndex. }
procedure SetAutoSnapAllMagnets(aAutoSnap: boolean; aGroupIndex: integer);

implementation

uses
  {$IFDEF CODESITE} CsIntf, {$ENDIF}
  SysUtils, Types;

var
  ActiveMagnets: TList;
  AllMagnets: TList;

procedure SetAutoSnapAllMagnets(aAutoSnap: boolean; aGroupIndex: integer);
var
  i: integer;
begin
  for i:=0 to AllMagnets.Count-1 do
    with TMagnet(AllMagnets[i]) do
      if (GroupIndex = aGroupIndex) then
        AutoSnap := aAutoSnap;
end;

function FindMagnet(aOwner: TComponent): TMagnet;
var
  i: integer;
begin
  Result := nil;
  for i := 0 to aOwner.ComponentCount - 1 do
    if aOwner.Components[i] is TMagnet then
    begin
      Result := TMagnet(aOwner.Components[i]);
      Exit;
    end;
end;

function GetMagnet(aOwner: TComponent): TMagnet;
begin
  Result := FindMagnet(aOwner);
  if not Assigned(Result) then
    Result := TMagnet.Create(aOwner);
end;

function GrowRect(aRect: TRect; Grow: integer): TRect;
begin
  Result.Left := aRect.Left - Grow;
  Result.Top := aRect.Top - Grow;
  Result.Right := aRect.Right + Grow;
  Result.Bottom := aRect.Bottom + Grow;
  if IsRectEmpty(aRect) then
    FillChar(Result, SizeOf(Result), #0);
end;

function RectArea(aRect: TRect): integer;
begin
  if IsRectEmpty(aRect) then
    Result := 0
  else
    Result := (aRect.Right - aRect.Left) * (aRect.Bottom - aRect.Top);
end;

function RectAligned(R1, R2: TRect): boolean;
var
  Tmp: TRect;
begin
  Result :=
    not IntersectRect(Tmp, R1, R2) and
    IntersectRect(Tmp, GrowRect(R1, 1), R2);
end;

function RectOverlap(R1, R2: TRect): boolean;
var
  Tmp: TRect;
begin
  Result := IntersectRect(Tmp, R1, R2) and not IsRectEmpty(Tmp);
end;

{ TMagnet }

procedure TMagnet.ApplyDeltaPos(aDelta: TPoint);
var
  R: TRect;
begin
  R := Area;
  OffsetRect(R, aDelta.X, aDelta.Y);
  Form.SetBounds(
    R.Left,
    R.Top,
    R.Right - R.Left,
    R.Bottom - R.Top);
end;

procedure TMagnet.ClientWndProc(var Message: TMessage);
var
  R: TRect;
  P: TPoint;
begin
  with Message do
  begin
    case Msg of
      WM_ENTERSIZEMOVE:
        begin
          FOldArea := Area;
          FDragStart := Area;
          FDragging := True;
        end;
      WM_EXITSIZEMOVE:
        begin
          ClusterSnapList;
          FOldArea := Area;
          FDragging := False;
        end;
      WM_WINDOWPOSCHANGING:
        with TWmWindowPosChanging(Message).WindowPos^ do
        begin
          FSnapList.Clear;
          if ((GetKeyState(VK_CONTROL) and $F0 = 0) xor (not AutoSnap)) and
            (Dragging) then
          begin
            if (cx <> Area.Right-Area.Left) or (cy <> Area.Bottom-Area.Top) and
              (flags and SWP_NOSIZE = 0) then
            begin
              R := Rect(x,y,x+cx,y+cy);
              // {$IFDEF CODESITE}CodeSite.SendRect('SIZE',R);{$ENDIF}
              WindowSizeChanging(R);
              FDragStart := R;
              x := R.Left;
              y := R.Top;
              cx := R.Right-R.Left;
              cy := R.Bottom-R.Top;
            end
            else
            if (flags and SWP_NOMOVE = 0) then
            begin
              P := Point(x, y);
              // {$IFDEF CODESITE}CodeSite.SendRect('MOVE',Rect(x,y,x+cx,y+cy));{$ENDIF}
              WindowPosChanging(P, cx, cy);
              AdjustCluster(
                Point(
                  P.X - FDragStart.Left,
                  P.Y - FDragSTart.Top));
              FDragStart := Rect(P.X, P.Y, P.X+cx, P.Y+cy);
              x := P.x;
              y := P.y;
            end;
            if FImmediateCluster then
              ClusterSnapList;
            // the window message is handled
            Result := 1;
          end
          else
          begin
            if Dragging and InCluster then
              UnCluster;
          end;
        end;
      WM_DESTROY:
        Active := False;
    end;

    if (Result = 0) then
      Result := CallWindowProc(FPrevClientProc, Form.Handle, Msg, wParam,
        lParam);
  end;
end;

constructor TMagnet.Create(aOwner: TComponent);
begin
  if not (aOwner is TCustomForm) then
    raise EComponentError.Create(ClassName + '.Owner must be a TForm');

  if Assigned(FindMagnet(aOwner)) then
    raise EComponentError.Create(ClassName +
      ' can occur only once in a TForm');

  inherited Create(aOwner);

  FActive := False;
  FAutoSnap := True;
  FRange := 15;
  FSnapOptions := [soInScreen, soMagnet];
  FDragging := False;

  FCluster := TList.Create;
  FCluster.Add(Self);

  FSnapList := TList.Create;

  FEnableClustering := True;
  FClusterSnapping := True;
  FImmediateCluster := False;

  FGroupIndex := 0;
  FClusterIndex := 0;

  AllMagnets.Add(Self);
end;

destructor TMagnet.Destroy;
begin
  AllMagnets.Extract(Self);

  Active := False;
  FCluster.Free;
  FSnapList.Free;
  inherited;
end;

function TMagnet.Form: TCustomForm;
begin
  Result := TCustomForm(Owner);
end;

function TMagnet.GetInCluster: Boolean;
begin
  Result := (FCluster.Count > 1);
end;

procedure TMagnet.AppendCluster(aCluster: TList);
var
  i: integer;
begin
  if (EnableClustering) then
    for i := 0 to aCluster.Count - 1 do
      if (FCluster.IndexOf(aCluster[i]) < 0) and
        (TMagnet(aCluster[i]).EnableClustering) then
      begin
        FCluster.Add(aCluster[i]);
      end;
end;

procedure TMagnet.SetActive(const Value: boolean);
begin
  if (Active <> Value) then
  begin
    if Value then
    begin
      // hook into the Form to receive the WM_WINDOWPOSCHANGING
      FClientInstance := MakeObjectInstance(ClientWndProc);
      FPrevClientProc := Pointer(GetWindowLong(Form.Handle, GWL_WNDPROC));
      SetWindowLong(Form.Handle, GWL_WNDPROC, Integer(FClientInstance));

      ActiveMagnets.Add(Self);
    end
    else
    begin
      if InCluster then
        UnCluster;

      // unhook from the Form to stop reveiving the WM_WINDOWPOSCHANGING
      SetWindowLong(Form.Handle, GWL_WNDPROC, Integer(FPrevClientProc));
      FreeObjectInstance(FClientInstance);

      ActiveMagnets.Extract(Self);
    end;

    FActive := Value;
  end;
end;

procedure TMagnet.SetRange(const Value: integer);
begin
  FRange := Value;
end;

procedure TMagnet.SetSnapOptions(const Value: TSnapOptions);
begin
  if (soInMainForm in Value) and (Form = Application.MainForm) then
    FSnapOptions := Value - [soInMainForm]
  else
    FSnapOptions := Value;
end;

function TMagnet.SnapToRect(var aLeft, aTop: integer;
  const aWidth, aHeight: integer; aRect: TRect; aBorder:
  TSnapBorder): boolean;
var
  ISect, RangeRect: TRect;
begin
  Result := False;

  if (aBorder = sbInner) then
  begin
    // left edge
    if (aLeft < aRect.Left + Range) then
    begin
      aLeft := aRect.Left;
      Result := True;
    end;
    // right edge
    if (aLeft + aWidth + Range > aRect.Right) then
    begin
      aLeft := aRect.Right - aWidth;
      Result := True;
    end;
    // top edge
    if (aTop < aRect.Top + Range) then

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品视频www在线观看| 91麻豆精品国产自产在线| 亚洲成人综合视频| 国产欧美日本一区视频| 欧美吞精做爰啪啪高潮| 国产成人免费9x9x人网站视频| 亚洲综合999| 久久精品视频一区| 日韩欧美国产午夜精品| 在线观看视频一区二区| 成人精品国产一区二区4080| 毛片av一区二区三区| 一区二区三区高清不卡| 国产精品午夜在线| 精品国产一区二区三区不卡| 欧美日韩小视频| 91尤物视频在线观看| 国产成人综合在线| 精品一区二区三区免费| 爽好多水快深点欧美视频| 亚洲色图在线看| 国产精品久久久久久久蜜臀| 日韩欧美国产一区二区三区| 欧美二区三区91| 日本韩国精品一区二区在线观看| 国产a视频精品免费观看| 久久精品国产**网站演员| 日一区二区三区| 亚洲老司机在线| 综合久久久久综合| 国产精品美女一区二区三区| 久久久www成人免费毛片麻豆| 欧美一区二区三区视频免费 | 日韩欧美亚洲一区二区| 69堂国产成人免费视频| 欧美在线观看一区| 欧美写真视频网站| 欧洲精品中文字幕| 欧美亚洲动漫精品| 欧美猛男超大videosgay| 欧美日韩在线观看一区二区 | 欧美视频一区二区三区四区| 99re这里都是精品| 91麻豆成人久久精品二区三区| 成人av在线资源| 91麻豆文化传媒在线观看| 99国内精品久久| 91丨国产丨九色丨pron| 91麻豆精品在线观看| 日本久久精品电影| 在线观看亚洲一区| 337p亚洲精品色噜噜噜| 91精品国产福利在线观看| 欧美一区2区视频在线观看| 日韩欧美色电影| 久久女同精品一区二区| 亚洲国产高清在线| 一区二区三区美女| 香蕉av福利精品导航 | 91丨porny丨国产入口| 色天天综合久久久久综合片| 在线观看91精品国产入口| 欧美色电影在线| 日韩一卡二卡三卡四卡| 国产视频一区不卡| 亚洲精品视频一区| 日日夜夜精品视频天天综合网| 久久精品国产网站| 国产91精品入口| 在线视频你懂得一区二区三区| 欧美日韩一区三区四区| 精品日韩在线观看| 中文字幕在线观看不卡视频| 夜色激情一区二区| 久久精品二区亚洲w码| av电影在线观看完整版一区二区 | 久久综合中文字幕| 国产精品你懂的在线| 亚洲一区二区精品3399| 精品亚洲porn| 91网站最新网址| 欧美美女一区二区三区| 久久久久国产精品厨房| 一区二区三区在线观看网站| 美腿丝袜一区二区三区| 成人国产精品免费观看动漫| 欧美日本一区二区三区四区| 久久久精品黄色| 亚洲第一主播视频| 国产91高潮流白浆在线麻豆| 欧美男同性恋视频网站| 国产欧美精品区一区二区三区 | 激情综合五月婷婷| 色综合久久中文综合久久97| 欧美一区二区三区免费大片| 中文字幕人成不卡一区| 蜜臀av亚洲一区中文字幕| 91亚洲精品久久久蜜桃网站| 日韩三级免费观看| 亚洲欧美国产三级| 国产精品正在播放| 欧美一区二区视频观看视频| 17c精品麻豆一区二区免费| 麻豆成人免费电影| 欧美午夜精品久久久久久孕妇| 国产清纯美女被跳蛋高潮一区二区久久w| 有码一区二区三区| 国产成a人无v码亚洲福利| 欧美日韩dvd在线观看| 亚洲欧美偷拍卡通变态| 国产精品一区二区三区四区| 欧美精品一二三| 樱花影视一区二区| 岛国av在线一区| 精品国产123| 无码av免费一区二区三区试看| 波多野结衣亚洲| 久久久久亚洲综合| 精品一区二区国语对白| 欧美性xxxxxx少妇| 一区二区三区成人| 99久久伊人精品| 欧美国产综合一区二区| 国产一区二区0| 欧美xxxxxxxx| 美女一区二区在线观看| 欧美精品第1页| 午夜精彩视频在线观看不卡| 91麻豆文化传媒在线观看| 亚洲欧洲av在线| 成人免费视频视频在线观看免费| 精品国产91九色蝌蚪| 精品一区二区三区视频| 精品国精品自拍自在线| 精品无码三级在线观看视频 | 自拍偷拍国产亚洲| 99精品视频一区| 国产精品久久久久久久午夜片 | 波多野结衣精品在线| 国产情人综合久久777777| 国产成人啪午夜精品网站男同| 精品国产乱码久久久久久久久| 免费成人在线视频观看| 欧美电视剧在线看免费| 久久国产婷婷国产香蕉| 亚洲精品在线免费播放| 国产麻豆成人传媒免费观看| 久久先锋资源网| 国产成人精品一区二| 国产农村妇女精品| 99久久免费国产| 亚洲综合在线视频| 欧美日韩一区不卡| 日韩极品在线观看| 精品久久久网站| 国产成人欧美日韩在线电影| 18涩涩午夜精品.www| 91成人免费在线| 日本在线不卡视频| 久久色中文字幕| av中文字幕不卡| 亚洲天堂精品在线观看| 欧美日韩一区 二区 三区 久久精品| 日韩高清中文字幕一区| 精品免费日韩av| 99久久国产免费看| 亚洲午夜一区二区三区| 欧美成人一区二区三区片免费| 国产精品1024久久| 亚洲欧美自拍偷拍| 欧美日韩国产123区| 国产尤物一区二区在线| 亚洲欧美另类图片小说| 欧美夫妻性生活| 成人一级视频在线观看| 亚洲综合丁香婷婷六月香| 精品黑人一区二区三区久久| 91网站在线观看视频| 麻豆成人免费电影| 亚洲日本va午夜在线电影| 欧美一区二区视频在线观看 | 欧美经典一区二区三区| 欧洲人成人精品| 国产黄人亚洲片| 无码av免费一区二区三区试看 | 老色鬼精品视频在线观看播放| 国产农村妇女精品| 7777精品伊人久久久大香线蕉 | 奇米影视在线99精品| 中文字幕av一区二区三区免费看| 在线观看区一区二| 国产乱码精品一品二品| 亚洲免费观看高清完整版在线观看熊 | 国产精品欧美精品| 日韩一区二区三区电影在线观看 | 欧美zozozo| 91高清视频免费看| 国产福利91精品一区二区三区| 亚洲国产精品影院| 国产精品国模大尺度视频|