zoukankan      html  css  js  c++  java
  • 动态生成一个设定好特殊样式的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

  • 相关阅读:
    .ini文件的介绍及对其进行操作
    一些.net 控件使用的小细节
    三、类型设计规范
    [转]TimerCallback 委托
    [转]简单XML文件C#操作方法
    [转]用托盘控制windows服务的c#实现
    [转]DateTime相关
    [转]创建Windows服务 C#
    一、框架设计的基础
    [转]得到当前执行的函数名、码行、源代码文件名
  • 原文地址:https://www.cnblogs.com/rogge7/p/6211448.html
Copyright © 2011-2022 走看看