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

📄 unit1.pas

📁 看到很多手写控件
💻 PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, OleServer, MSINKAUTLib_TLB, ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    InkCLT: TInkCollector;
    Memo1: TMemo;
    Panel1: TPanel;
    Button1: TButton;
    InkRecognizerContext1: TInkRecognizerContext;
    procedure FormCreate(Sender: TObject);
    procedure InkCLTStroke(ASender: TObject; const Cursor: IInkCursor;
      const Stroke: IInkStrokeDisp; var Cancel: WordBool);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  InkCLT.hWnd := panel1.Handle;
  InkCLT.Enabled := true;
  InkCLT.DefaultDrawingAttributes.Color := clRed; // 墨水颜色
  InkCLT.DefaultDrawingAttributes.Width := 200; // 笔的宽度
end;

procedure TForm1.InkCLTStroke(ASender: TObject; const Cursor: IInkCursor;
  const Stroke: IInkStrokeDisp; var Cancel: WordBool);
begin
  Memo1.Lines.Clear;
  Memo1.Lines.Add(Stroke.Ink.Strokes.ToString);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  InkCLT.Ink.DeleteStrokes(InkCLT.Ink.Strokes);
  Panel1.Refresh;
end;

end.

⌨️ 快捷键说明

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