zoukankan      html  css  js  c++  java
  • GetPropInfo Font Size

    设置font size,遍历所有控件,有的控件没有font属性,所以要用GetPropInfo判断

    if (GetPropInfo(cmp, "font"))

    function GetObjectProperty(

        const AObject   : TObject;

        const APropName : string

        ):TObject;

    var

      PropInfo:PPropInfo;

    begin

      Result  :=  nil;

      PropInfo:=GetPropInfo(AObject.ClassInfo,APropName);

      if Assigned(PropInfo) and

          (PropInfo^.PropType^.Kind = tkClass) then

        Result  :=  GetObjectProp(AObject,PropInfo);

    end;



    function SetIntegerPropertyIfExists(

        const AObject   : TObject;

        const APropName : string;

        const AValue    : integer

        ):Boolean;

    var

      PropInfo:PPropInfo;

    begin

      PropInfo:=GetPropInfo(AObject.ClassInfo,APropName);

      if Assigned(PropInfo) and

          (PropInfo^.PropType^.Kind = tkInteger) then

      begin

        SetOrdProp(AObject,PropInfo,AValue);

        Result:=True;

      end else

        Result:=False;

    end;



    //调用

    procedure TFrmTest.FormCreate(Sender: TObject);

    var

      objTemp : TObject;

    begin

      objTemp :=  GetObjectProperty(Self,'Font');

      if Assigned(objTemp) then

        SetIntegerPropertyIfExists(objTemp,'Size',9);

    end;

  • 相关阅读:
    ureport2 数据源配置
    ureport2 + spring boot 搭建
    alibaba
    Maven Helper
    在Idea中连接数据库并生成实体类
    Intellij jrebel 热部署 安装
    IDEA使用说明
    JPA 常用注解 (hibernate)
    vue + canvas 图片加水印
    vue——批量下载图片
  • 原文地址:https://www.cnblogs.com/cb168/p/3912546.html
Copyright © 2011-2022 走看看