国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

枚舉並設(shè)置界面的Caption之多語(yǔ)言方法

2019-11-18 18:03:55
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
 

uses
  ..., TypInfo;

function TForm1.IsAPRopExist(AInst: TObject; const PropName: string): Boolean;
var
  PropInfo: PPropInfo;
begin
  Result := False;
  PropInfo := GetPropInfo(AInst, PropName);
  if PropInfo <> nil then
    Result := PropInfo.Name = PropName;
end;


procedure TForm1.Button2Click(Sender: TObject);
var
  i: Integer;
begin
  for i := 0 to Self.ComponentCount - 1 do
  begin
    if IsAPropExist(Self.Components[i], 'Caption') then
      SetPropValue(Self.Components[i], 'Caption', IntToStr(i));
  end;
end;

 

 

-------------------------------------------------------------------------------

uses
  ..., TypInfo;

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
  aComponent: TComponent;
  PropInfo: PPropInfo;
  ViewText, ViewHint: string;
begin
  ViewText := 'Hello world'; // for debug use, you should comment these 2 lines
  ViewHint := 'the hint';    //   and then implement GetInfoByName method.

  for i := 0 to ComponentCount - 1 do
  begin
    aComponent := Components[i];
    PropInfo := GetPropInfo(aComponent.ClassInfo, 'Caption');
    if not Assigned(PropInfo) then // Caption property of aComponent NOT exists
    begin
      // turn to search Text property
      PropInfo := GetPropInfo(aComponent.ClassInfo, 'Text');
      if not Assigned(PropInfo) then // Text property of aComponent NOT exists
        Continue;
    end;

    // comes here, either Caption or Text property must exists
    // first, find the ViewText and ViewHint of the aComponent by the name
    // GetInfoByName(aComponent.Name, ViewText, ViewHint);
    SetStrProp(aComponent, PropInfo, ViewText);

    // then, search Hint property
    PropInfo := GetPropInfo(aComponent.ClassInfo, 'Hint');
    if Assigned(PropInfo) then
      SetStrProp(aComponent, PropInfo, ViewHint);
  end;
end;


上一篇:win2000/xp/2003下不能關(guān)閉程序的方法

下一篇:使用HOOK隨心監(jiān)視Windows

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
學(xué)習(xí)交流
熱門圖片

新聞熱點(diǎn)

疑難解答

圖片精選

網(wǎng)友關(guān)注

主站蜘蛛池模板: 额敏县| 大足县| 偏关县| 青铜峡市| 准格尔旗| 若羌县| 安顺市| 黑龙江省| 哈尔滨市| 泰来县| 揭阳市| 三河市| 昌图县| 游戏| 天峨县| 太湖县| 吉安县| 陇川县| 磴口县| 临夏市| 安阳县| 祁连县| 大渡口区| 湘阴县| 舒兰市| 逊克县| 邛崃市| 南投县| 望谟县| 六安市| 门头沟区| 公主岭市| 应城市| 潞城市| 基隆市| 义马市| 武清区| 阿合奇县| 綦江县| 赣州市| 旺苍县|