⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 udragpoint.pas

📁 运行时设计控件的一个小例子
💻 PAS
字号:
//---------TDragPoint--------------------------
unit UDragPoint;

interface

uses Windows, Messages,Controls,Classes,Graphics;

type
  TDragPoint=class(TCustomControl)
  protected
    procedure Paint;override;
  public
    //处理移动时用的变量
    isDown:Boolean;
    PrevP,NextP:TPoint;
    constructor Create(AOwner: TComponent); override;
    procedure CreateWnd; override;
  published
    property OnMouseMove;
    property OnMouseDown;
    property OnMouseUp;
  end;

implementation

{ TDragPoint }

//----------------------------------------------------------------------------//
constructor TDragPoint.Create;
begin
  inherited Create(AOwner);
  isDown:=False;
  Width:=5;
  Height:=5;
end;

//----------------------------------------------------------------------------//
procedure TDragPoint.CreateWnd;
begin
  inherited;
    //使该类位窗口最前
    BringWindowToTop(self.Handle);
end;

//----------------------------------------------------------------------------//
procedure TDragPoint.Paint;
begin
  Canvas.Brush.Color:=clBlack;
  Canvas.Brush.Style:=bsSolid;
  Canvas.Rectangle(0,0,width,Height);
end;

//----------------------------------------------------------------------------//
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -