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;

  • 相关阅读:
    react 踩坑第一天
    vue-cli+axios+跨域
    vuex 进阶 mapState mapGetter mapActions mapMutations
    vue Bus
    各种html布局
    echarts柱状图设置渐变色
    html设置一个当前时间
    css设置字体渐变色
    C++中指针与引用详解
    go-admin 开源后台管理系统
  • 原文地址:https://www.cnblogs.com/cb168/p/3912546.html
Copyright © 2011-2022 走看看