zoukankan      html  css  js  c++  java
  • How to load custom styles at runtime (不会翻译,只有抄了 )

    原文 :http://blogs.embarcadero.com/sarinadupont/2013/10/16/how-to-load-custom-styles-at-runtime/

     

     

    How to load custom styles at runtime

    During my session at CodeRage, I briefly talked about how to load custom styles at runtime. I wanted to elaborate on this topic and provide some detailed steps.

    In this example, we are creating a mobile app for iOS and Android that uses the ‘Jet’ Premium Style. I added both styles via the resources dialog in the IDE and used the TStyleManager.LoadFromResource method to load either style at runtime.

    When loading custom styles at runtime using the steps below, you don’t see the style at design time.

    The first step is to add both styles to resources via ‘Project->Resources and Images’ in the IDE.

    Click on ‘Add’, browse to the location of your style (i.e. C:PremiumPackiOS) and select the style (i.e. iOSJet.style). Then click on ‘Open’.

    Change the name of the Resource Identifier to match the string in your code.

    I then created the following OnCreate event for my Form:

    procedure TForm1.FormCreate(Sender: TObject);
    var
    Style: TFMXObject;
    begin
    Style := nil;
    {$IFDEF IOS}
    Style := TStyleManager.LoadFromResource(HInstance, ‘iOSJet’, RT_RCDATA);
    {$ENDIF}
    {$IFDEF ANDROID}
    Style := TStyleManager.LoadFromResource(HInstance, ‘AndroidJet’, RT_RCDATA);
    {$ENDIF}
    if Style <> nil then
    TStyleManager.SetStyle(Style);
    end;

    At runtime, on my iOS device, I see the iOSJet style, and on my Android device, I see the AndroidJet style.

    Sincerely,

    Sarina

  • 相关阅读:
    P2765 魔术球问题 网络流二十四题重温
    搬东西 dp
    Q
    P2774 方格取数问题 网络流重温
    2019牛客暑期多校训练1
    E. A Simple Task
    Codeforces Round #575 (Div. 3) 昨天的div3 补题
    自动化测试如何准备测试数据
    金三银四,资深HR给面试者的十大建议
    我的自动化测试之路[转载]
  • 原文地址:https://www.cnblogs.com/key-ok/p/3532719.html
Copyright © 2011-2022 走看看