易截截图软件、单文件、免安装、纯绿色、仅160KB

delphi 将汉字翻译成拼音缩写的函数介绍

unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
private
    { Private declarations }
public
    { Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
//每个汉字的首字母
function GetPyChar(const HZ: AnsiString): string;
const
HZCode: array[0..25, 0..1] of Integer = ((1601, 1636), (1637, 1832), (1833, 2077),
    (2078, 2273), (2274, 2301), (2302, 2432), (2433, 2593), (2594, 2786), (9999, 0000),
    (2787, 3105), (3106, 3211), (3212, 3471), (3472, 3634), (3635, 3722), (3723, 3729),
    (3730, 3857), (3858, 4026), (4027, 4085), (4086, 4389), (4390, 4557), (9999, 0000),
    (9999, 0000), (4558, 4683), (4684, 4924), (4925, 5248), (5249, 5589));
var
i,j,HzOrd: Integer;
begin
i := 1;
while i <= Length(HZ) do
    begin
    if (HZ[i] >= #160) and (HZ[i + 1] >= #160) then
    begin
      HzOrd := (Ord(HZ[i]) - 160) * 100 + Ord(HZ[i + 1]) - 160;
      for j := 0 to 25 do
      begin
        if (HzOrd >= HZCode[j][0]) and (HzOrd <= HZCode[j][1]) then
        begin
          Result := Result + Char(Byte('A') + j);
          Break;
        end;
      end;
      Inc(i);
    end else Result := Result + HZ[i];
      Inc(i);
end;


相关文档:

DELPHI基础教程读书笔记

设置字体的过程
Procedure TForm1.FontDlgApply(Sender:Tobject);
begin
Button1.Font:= FontDialog1.Font;
end; 
该程序只有当用户按动About框的按钮或被About窗控制图标关闭窗口后,才会回到主窗体中,而不能与第一个窗体发生交互行为。这就是方法Show和ShowModal的主要不同之处
集合类型是一群相同类型元素的组合 ......

Delphi 我的代码之窗体移动

技术交流,DH讲解. 这个工具是好早好早以前写的,我这个喜欢在家边看电影边写写代码或者看电子书,所以经常会将网页移到屏幕的左上角或者右上角,而且要置顶.所以就写了这样一个工具,这个工具主要是对句柄的操作,还有就是窗体样式以及几个API的例子,比较基础. 整个文件在 here(Can't Input Chinese:() 下面把代码贴出来,希望 ......

Smarter Records in Turbo Delphi / Delphi 2006

type
TTurboRecord = record
strict private
fNameValue : integer;
function GetName: string;
public
NamePrefix : string;
constructor Create(const initNameValue : integer) ;
property Name : string read GetName;
end;
var
Form1: TForm1;
implementation
{$R *.dfm} ......

Delphi 嵌入汇编 进Ring0 360tray.exe

unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, TlHelp32;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Pub ......

Delphi abc

1. 字符串连接直接用+,与Java和Python中的相同
2. 执行外部命令使用winexec,ShellExecute
    eg. ShellExecute(0, 'open', 'jre/bin/java', '-lang zh-CN', 'E:\myfolder', SW_SHOW);
3. 判断文件、文件夹是否存在
    FileExists('C:\Users\bill\somefile.txt')
    ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号