动态生成一个设定好特殊样式的Tlabel,快速生成代码

动态生成一个设定好特殊样式的Tlabel,快速生成代码;

1、自己先在可视化界面设定一个Label,像这样:

   

2、选择label,快捷键ctrl+C 复制,粘贴带代码编辑器去,会生成一段这样的窗体代码;

object lbl1: TLabel
  Left = 1
  Top = 1
  Width = 289
  Height = 47
  Align = alLeft
  Alignment = taCenter
  Caption = '   '#20013#22269#31227#21160#24191#35199#20998#20844#21496'GPS'#25351#25381#35843#24230#24179#21488
  Color = 16645629
  Font.Charset = GB2312_CHARSET
  Font.Color = clWhite
  Font.Height = -16
  Font.Name = #21326#25991#20013#23435
  Font.Style = []
  ParentColor = False
  ParentFont = False
  Layout = tlCenter
  ExplicitHeight = 19
end
View Code

3、在代码里面修改一下即可,修改成:

fProjName :TLabel;//定义

{
$IFDEF GuangXiNanTie} fProjName :=TLabel.Create(self); with fProjName do begin Parent :=Self; Left := 1; Top := 1; //Width = 289 //Height = 47 Align := alLeft; Alignment := taCenter; Caption :=' 中国移动广西公司GPS指挥调度平台'; Color := $00FDFDFD; Font.Charset := ANSI_CHARSET; Font.Color := $00FDFDFD; Font.Height := -15; Font.Name := #24494#36719#38597#40657; Font.Style := []; ParentColor := False; ParentFont := False; Layout := tlCenter ; //ExplicitHeight = 19 end; {$ENDIF}

 

拓展:DEFINE的用法 :定义在文件头,Interface之前,只能在本单元生效,举例:

unit uTitleBar;
//{$DEFINE GuangXiNanTie}

interface

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值