每日程炼-delphi2010 键盘控件(TTouchKeyboard)

程序员职业之路已经完成了 ~今天开始每日一练,收集和向网络学习,提高自己。
delphi2010有一个新加的控件号称是 TTouchKeyboard, 触屏控件。

—————————————————————————————————————–

代码部分:
———————————————————————————————————————


[delphi] view plain copy

print?

  1. unit Unit1;  
  2.   
  3. interface  
  4.   
  5. uses  
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  
  7.   Dialogs, Keyboard, StdCtrls, TeCanvas;  
  8.   
  9. type  
  10.   TForm1 = class(TForm)  
  11.    TouchKeyboard1: TTouchKeyboard;  
  12.     Edit1: TEdit;  
  13.     Memo1: TMemo;  
  14.     CheckBox1: TCheckBox;  
  15.     CheckBox2: TCheckBox;  
  16.     CheckBox3: TCheckBox;  
  17.     ButtonColor1: TButtonColor;  
  18.     ButtonColor2: TButtonColor;  
  19.   
  20.     procedure CheckBox1Click(Sender: TObject);  
  21.     procedure FormCreate(Sender: TObject);  
  22.     procedure ButtonColor1Click(Sender: TObject);  
  23.     procedure ButtonColor2Click(Sender: TObject);  
  24.     procedure CheckBox2Click(Sender: TObject);  
  25.     procedure CheckBox3Click(Sender: TObject);  
  26.   private  
  27.     { Private declarations }  
  28.   public  
  29.     { Public declarations }  
  30.   end;  
  31.   
  32. var  
  33.   Form1: TForm1;  
  34.   
  35. implementation  
  36.   
  37. {$R *.dfm}  
  38.   
  39. procedure TForm1.ButtonColor1Click(Sender: TObject);  
  40. begin  
  41.   TouchKeyboard1.GradientStart := TButtonColor(Sender).SymbolColor;  
  42. end;  
  43.   
  44. procedure TForm1.ButtonColor2Click(Sender: TObject);  
  45. begin  
  46.    TouchKeyboard1.GradientEnd := TButtonColor(Sender).SymbolColor;  
  47. end;  
  48.   
  49. procedure TForm1.CheckBox1Click(Sender: TObject);  
  50. begin  
  51.   case CheckBox1.Checked of  
  52.     True: TouchKeyboard1.DrawingStyle := TCustomTouchKeyboard.TDrawingStyle.dsGradient;  
  53.     False: TouchKeyboard1.DrawingStyle := TCustomTouchKeyboard.TDrawingStyle.dsNormal;  
  54.   end; {注意 TDrawingStyle 类型是定义在 TCustomTouchKeyboard 内部的}  
  55.   
  56.   case CheckBox1.Checked of  
  57.     True: CheckBox1.Caption := 'DrawingStyle := dsGradient';  
  58.     False: CheckBox1.Caption := 'DrawingStyle := dsNormal';  
  59.   end;  
  60.   
  61. end;  
  62.   
  63.   
  64. procedure TForm1.CheckBox2Click(Sender: TObject);  
  65. begin  
  66.    case CheckBox2.Checked of  
  67.     True: begin  
  68.       TouchKeyboard1.Layout := 'NumPad';  
  69.       TouchKeyboard1.Width := 180;  
  70.       TouchKeyboard1.Height := 150;  
  71.       CheckBox2.Caption := 'Layout := NumPad';  
  72.     end;  
  73.     False: begin  
  74.       TouchKeyboard1.Layout := 'Standard';  
  75.       TouchKeyboard1.Width := 550;  
  76.       TouchKeyboard1.Height := 180;  
  77.       CheckBox2.Caption := 'Layout := Standard';  
  78.     end; {注意: 这里的 Layout 属性是个字符串}  
  79.   end;  
  80.   
  81. end;  
  82.   
  83. procedure TForm1.CheckBox3Click(Sender: TObject);  
  84. begin  
  85.    case CheckBox3.Checked of  
  86.     True: begin  
  87.       TouchKeyboard1.CaptionOverrides.SetCaption('Esc', '退出');  
  88.       TouchKeyboard1.CaptionOverrides.SetCaption('Backspace', '退格');  
  89.       TouchKeyboard1.CaptionOverrides.SetCaption('Del', '删除');  
  90.       TouchKeyboard1.CaptionOverrides.SetCaption('Enter', '回车');  
  91.       {Esc Backspace Tab Del Caps Enter LeftShift RightShift LeftCtrl LeftAlt RightAlt RightCtrl}  
  92.     end;  
  93.     False: TouchKeyboard1.CaptionOverrides.Clear;  
  94.   end;  
  95.   TouchKeyboard1.Redraw; {重绘}  
  96.   
  97. end;  
  98.   
  99. procedure TForm1.FormCreate(Sender: TObject);  
  100. begin  
  101.   Memo1.Font.Color := clBlue;  
  102.   Memo1.Font.Size := 12;  
  103.   Memo1.ScrollBars := ssBoth;  
  104.   
  105.   Edit1.Font.Color := clRed;  
  106.   Edit1.Font.Size := 12;  
  107.   
  108.   CheckBox1.Caption := '背景色';  
  109.   CheckBox2.Caption := '大小键盘切换';  
  110.   CheckBox3.Caption := '功能键重命名';  
  111.   
  112. end;  
  113.   
  114. end.  

------------------------------------------------------------------------------------
窗体部分
-------------------------------------------------------------------------------------

[delphi] view plain copy

print?

  1. object Form1: TForm1  
  2.   Left = 0  
  3.   Top = 0  
  4.   Caption = #24858#20154#31508#35760'-www.foolcode.com'  
  5.   ClientHeight = 336  
  6.   ClientWidth = 564  
  7.   Color = clBtnFace  
  8.   Font.Charset = DEFAULT_CHARSET  
  9.   Font.Color = clWindowText  
  10.   Font.Height = -11  
  11.   Font.Name = 'Tahoma'  
  12.   Font.Style = []  
  13.   OldCreateOrder = False  
  14.   OnCreate = FormCreate  
  15.   PixelsPerInch = 96  
  16.   TextHeight = 13  
  17.   object TouchKeyboard1: TTouchKeyboard  
  18.     Left = 8  
  19.     Top = 148  
  20.     Width = 550  
  21.     Height = 180  
  22.     GradientEnd = clSilver  
  23.     GradientStart = clGray  
  24.     Layout = 'Standard'  
  25.   end  
  26.   object Memo1: TMemo  
  27.     Left = 8  
  28.     Top = 43  
  29.     Width = 297  
  30.     Height = 99  
  31.     ImeName = #20013#25991'('#31616#20307') - '#25628#29399#25340#38899#36755#20837#27861  
  32.     Lines.Strings = (  
  33.       'Memo1')  
  34.     TabOrder = 1  
  35.   end  
  36.   object Edit1: TEdit  
  37.     Left = 8  
  38.     Top = 8  
  39.     Width = 297  
  40.     Height = 21  
  41.     ImeName = #20013#25991'('#31616#20307') - '#25628#29399#25340#38899#36755#20837#27861  
  42.     TabOrder = 2  
  43.     Text = 'Edit1'  
  44.   end  
  45.   object ButtonColor1: TButtonColor  
  46.     Left = 327  
  47.     Top = 43  
  48.     Width = 102  
  49.     Caption = 'ButtonColor1'  
  50.     TabOrder = 3  
  51.     OnClick = ButtonColor1Click  
  52.   end  
  53.   object ButtonColor2: TButtonColor  
  54.     Left = 454  
  55.     Top = 41  
  56.     Width = 102  
  57.     Caption = 'ButtonColor2'  
  58.     TabOrder = 4  
  59.     OnClick = ButtonColor2Click  
  60.   end  
  61.   object CheckBox1: TCheckBox  
  62.     Left = 327  
  63.     Top = 10  
  64.     Width = 223  
  65.     Height = 17  
  66.     Caption = 'CheckBox1'  
  67.     TabOrder = 5  
  68.     OnClick = CheckBox1Click  
  69.   end  
  70.   object CheckBox2: TCheckBox  
  71.     Left = 327  
  72.     Top = 88  
  73.     Width = 194  
  74.     Height = 17  
  75.     Caption = 'CheckBox2'  
  76.     TabOrder = 6  
  77.     OnClick = CheckBox2Click  
  78.   end  
  79.   object CheckBox3: TCheckBox  
  80.     Left = 327  
  81.     Top = 111  
  82.     Width = 194  
  83.     Height = 17  
  84.     Caption = 'CheckBox3'  
  85.     TabOrder = 7  
  86.     OnClick = CheckBox3Click  
  87.   end  
  88. end  
时间: 2024-08-01 10:31:01

每日程炼-delphi2010 键盘控件(TTouchKeyboard)的相关文章

iOS8新特性扩展(Extension)应用之四——自定义键盘控件

iOS8新特性扩展(Extension)应用之四--自定义键盘控件         iOS8系统的开放第三方键盘,使得用户在输入法的选择上更加自主灵活,也更加贴近不同语言的输入风格.这篇博客,将介绍如何开发一个第三方的键盘控件. 一.了解UIInputViewController类         UIInputViewController是系统扩展支持键盘扩展的一个类,通过这个类,我们可以自定义一款我们自己的键盘提供给系统使用.         首先,我们先来看一下这个类中的一些属性和方法:

Extjs form 表单添加已有的软键盘控件

问题描述 Extjs form 表单添加已有的软键盘控件 现在那两个输入框都是普通的输入框. 我想换成带 软键盘控件的输入框. 我的软键盘输入框是单独的js. 在页面是只要加入 writeEditObject("safeedit",{"entertype":"edit","width":170,"height":24,"accepts":"[:print:]+",&q

Android UI设计系列之自定义ViewGroup打造通用的关闭键盘小控件ImeObserverLayout(9)_Android

转载请注明出处:http://blog.csdn.net/llew2011/article/details/51598682 我们平时开发中总会遇见一些奇葩的需求,为了实现这些需求我们往往绞尽脑汁有时候还茶不思饭不香的,有点夸张了(*^__^*)--我印象最深的一个需求是在一段文字中对部分词语进行加粗显示.当时费了不少劲,不过还好,这个问题最终解决了,有兴趣的童靴可以看一下:Android UI设计之<六>使用HTML标签,实现在TextView中对部分文字进行加粗显示. 之前产品那边提了这样

2KB内存单片机上实现彩屏GUI控件库

一. 综述 嵌入式系统发展日新月异,安卓和ios已然战胜了当年雄霸天下的塞班,界面是我们特别看重的因素之一.不过你考虑过自己做一套系统,写一个界面库么?在单片机上自制系统,可以很好的锻炼编程能力和架构设计能力. 这些界面库都是在底层画点画线的驱动程序上实现的,基于我的XMOVE动作感应系统.基本具有硬件无关性.支持彩屏320*240的分辨率,由于考虑不同分辨率的开发过分复杂(想想看你需要计算每个点布局在哪个位置,这对安卓等系统都是大问题),因此我并没有太过完善的考虑过其他分辨率. 我已经写过一篇

XMOVE3.0手持终端——软件介绍(二):在2KB内存的单片机上实现的彩屏GUI控件库

一. 综述 嵌入式系统发展日新月异,安卓和ios已然战胜了当年雄霸天下的塞班,界面是我们特别看重的因素之一.不过你考虑过自己做一套系统,写一个界面库么?在单片机上自制系统,可以很好的锻炼编程能力和架构设计能力. 这些界面库都是在底层画点画线的驱动程序上实现的,基于我的XMOVE动作感应系统.基本具有硬件无关性.支持彩屏320*240的分辨率,由于考虑不同分辨率的开发过分复杂(想想看你需要计算每个点布局在哪个位置,这对安卓等系统都是大问题),因此我并没有太过完善的考虑过其他分辨率. 我已经写过一篇

中行安全控件可导致Windows 8笔记本键盘失灵

在 Windows 8 尚处在预发布版的时候,各大软件厂商和在线服务提供商都在紧锣密鼓地开展开发和测试工作,为提供兼容 Windows 8 的程序做准备.在当时,我曾写过一则关于建行网银盾无法使用的问题和其解决方案.随着 Windows 8 的正式上市,Win8 与网站和软件的兼容性还是值得称赞的,这也得归功于各个软件提供商的配合与努力.对于日常使用的网银,很多都已经更新了需要用户安装的控件,用户在 Win8 上使用网银,便不会遇到阻碍性问题. 但在我最近买了一款 DELL Vostro 笔记本

利用ASP.NET日期控件制作“会议日程安排”

大家应该比较熟悉outlook里的日程安排,点进去就是一个日历版面,选择某日即可添加当天的日程安排,还有偶尔玩下开心网的兄弟们应该也知道有个日程组件,其实和outlook有点兄弟关系,只不过比outlook做的要漂亮些:) 从VS03到VS08里,ASP.NET一直带有个Calendar日历控件,我不知道历经三代岁月沧桑的交替,这个控件发生了多少变化,不是很清楚,因为从来就没在项目中用过,最近的一个项目倒是提到了这方面的需求,要求用户登录点"会议日程"能显示当前月的日期和相应具体日期有

解决安装网银安全控件后键盘失灵问题

[问题描述] 一些笔记本(戴尔,华硕比较常见)安装网银控件后无法使用键盘, [解决办法] 中国银行 删除以下文件 C:windowssystem32drivers/ProtectorA.sys 中行的网银如果找不到C:windowssystem32drivers/ProtectorA.sys 可以找下删除C:windowssystem32drivers/ProtectorA.sys 这个文件 邮政储蓄银行 删除C:WINDOWSsystem32drivers/PECKP.SYS, 电脑重启, 问

webbrowser-WebBrowser控件 显示的网页中的下拉框 无法使用键盘的上下按键

问题描述 WebBrowser控件 显示的网页中的下拉框 无法使用键盘的上下按键 代码如下: IWebBrowser2* iWebBrowser; VARIANT varMyURL; static CAxWindow WinContainer; LPOLESTR pszName=OLESTR("shell.Explorer.2"); RECT rc; GetClientRect(hWnd, &rc); WinContainer.Create(hWnd, rc, 0,WS_CHI