📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
LogicFont :TagLogFontA;
//逻辑字体
TempFont,PrevFont :HFONT;
//字体句柄
TempDC :HDC;
//图形设备句柄
begin
LogicFont.lfHeight := 70;
//设置字高
LogicFont.lfWidth := 40;
//设置字宽
LogicFont.lfWeight := 10;
//设置字体笔划粗细程度
LogicFont.lfUnderline := 0;
//设置下划线为没有
LogicFont.lfStrikeOut := 0;
//设置没有删除线
LogicFont.lfItalic := 0;
//设置不为斜体
LogicFont.lfCharSet := GB2312_CHARSET;
//设置字符集
LogicFont.lfEscapement := -StrToInt(Edit2.Text)*10;
LogicFont.lfOrientation := -StrToInt(Edit2.Text)*10;
//设置顺时针方向与X轴的夹角
LogicFont.lfFaceName := '宋体';
//设置字体名称
TempFont := CreateFontIndirect(LogicFont);
//创建逻辑字体
TempDC := GetDC(Handle);
//取得窗口的设备句柄
PrevFont := SelectObject(TempDC, TempFont);
//取出窗口设备的当前字体,并替换为新字体
SetTextColor(TempDC, clBlue);
//设置设备窗口的文字色彩
SetBkMode(TempDC,TRANSPARENT);
//去掉文字白底
TextOut(TempDC, StrToInt(Edit3.Text), StrToInt(Edit4.Text), PChar(Edit1.Text), Length(Edit1.Text));
//输出文字
SelectObject(TempDC, PrevFont);
//恢复原有的字体
DeleteObject(TempFont);
//删除逻辑字体
ReleaseDC(Handle, TempDC);
//释放设备接口
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -