📄 getcharabcwidthsu.pas
字号:
unit GetCharABCWidthsU;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Grids;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Label1: TLabel;
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormActivate(Sender: TObject);
var
CharWidths: array[0..25]of TABC; // holds character ABC widths
Count: Integer; // general loop control variable
begin
{initialize the string grid}
StringGrid1.Cells[0,0] := 'Character';
StringGrid1.Cells[1,0] := '''A'' Width';
StringGrid1.Cells[2,0] := '''B'' Width';
StringGrid1.Cells[3,0] := '''C'' Width';
{retrieve ABC widths for all upper case letters}
GetCharABCWidths(Form1.Canvas.Handle, Ord('A'), Ord('Z'), CharWidths);
{display the ABC widths for all uppercase letters}
for Count := 0 to 26 do
begin
StringGrid1.Cells[0, Count+1] := Char(Ord('A')+Count);
StringGrid1.Cells[1, Count+1] := IntToStr(CharWidths[Count].abcA);
StringGrid1.Cells[2, Count+1] := IntToStr(CharWidths[Count].abcB);
StringGrid1.Cells[3, Count+1] := IntToStr(CharWidths[Count].abcC);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -