Delphi TouchKeyboard1 基本用法


本文整理自网络,侵删。

 
演示:


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Keyboard, StdCtrls, TeCanvas;

type
  TForm1 = class(TForm)
   TouchKeyboard1: TTouchKeyboard;
    Edit1: TEdit;
    Memo1: TMemo;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    CheckBox3: TCheckBox;
    ButtonColor1: TButtonColor;
    ButtonColor2: TButtonColor;

    procedure CheckBox1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ButtonColor1Click(Sender: TObject);
    procedure ButtonColor2Click(Sender: TObject);
    procedure CheckBox2Click(Sender: TObject);
    procedure CheckBox3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ButtonColor1Click(Sender: TObject);
begin
  TouchKeyboard1.GradientStart := TButtonColor(Sender).SymbolColor;
end;

procedure TForm1.ButtonColor2Click(Sender: TObject);
begin
   TouchKeyboard1.GradientEnd := TButtonColor(Sender).SymbolColor;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  case CheckBox1.Checked of
    True: TouchKeyboard1.DrawingStyle := TCustomTouchKeyboard.TDrawingStyle.dsGradient;
    False: TouchKeyboard1.DrawingStyle := TCustomTouchKeyboard.TDrawingStyle.dsNormal;
  end; {注意 TDrawingStyle 类型是定义在 TCustomTouchKeyboard 内部的}

  case CheckBox1.Checked of
    True: CheckBox1.Caption := 'DrawingStyle := dsGradient';
    False: CheckBox1.Caption := 'DrawingStyle := dsNormal';
  end;

end;


procedure TForm1.CheckBox2Click(Sender: TObject);
begin
   case CheckBox2.Checked of
    True: begin
      TouchKeyboard1.Layout := 'NumPad';
      TouchKeyboard1.Width := 180;
      TouchKeyboard1.Height := 150;
      CheckBox2.Caption := 'Layout := NumPad';
    end;
    False: begin
      TouchKeyboard1.Layout := 'Standard';
      TouchKeyboard1.Width := 550;
      TouchKeyboard1.Height := 180;
      CheckBox2.Caption := 'Layout := Standard';
    end; {注意: 这里的 Layout 属性是个字符串}
  end;

end;

procedure TForm1.CheckBox3Click(Sender: TObject);
begin
   case CheckBox3.Checked of
    True: begin
      TouchKeyboard1.CaptionOverrides.SetCaption('Esc', '退出');
      TouchKeyboard1.CaptionOverrides.SetCaption('Backspace', '退格');
      TouchKeyboard1.CaptionOverrides.SetCaption('Del', '删除');
      TouchKeyboard1.CaptionOverrides.SetCaption('Enter', '回车');
      {Esc Backspace Tab Del Caps Enter LeftShift RightShift LeftCtrl LeftAlt RightAlt RightCtrl}
    end;
    False: TouchKeyboard1.CaptionOverrides.Clear;
  end;
  TouchKeyboard1.Redraw; {重绘}

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Memo1.Font.Color := clBlue;
  Memo1.Font.Size := 12;
  Memo1.ScrollBars := ssBoth;

  Edit1.Font.Color := clRed;
  Edit1.Font.Size := 12;

  CheckBox1.Caption := '背景色';
  CheckBox2.Caption := '大小键盘切换';
  CheckBox3.Caption := '功能键重命名';

end;

end.

相关阅读 >>

Delphi中使用tpathanimation

Delphi读取webbrowse中的图片显示在image中

Delphi windows 下用 Delphi 代码杀死进程,或者杀死自己

Delphi 创建多级目录

Delphi 获取文件大小根据显示gb mb kb b

选择 Delphi 的 9 条理由

Delphi 写开关防火墙代码

Delphi获取13位格林治时间实现方法

Delphi 调用shellexecute打开txt文本

Delphi xe 获取android的路径信息

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...