Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
295
How to set selected font in FontListTool
posted

You can set the SelectedIndex, however how can chose the correct font if I already have the font name? There doesn't seem to be a way to find the correct index to select?

Thanks,

Beardo

Parents
No Data
Reply
  • 5118
    posted

    Hi,

    So you've noticed the FontListTool doesn't seem to have these methods to support what you are after and I almost lost faith in the FontListTool but only for a moment; we can look at the class inheritance and notice that a FontListTool inherits from a ComboBoxTool.  This class has what we need to do the operations you are after...

    myFontListTool.Value = myFontListTool.ValueList.FindByDataValue("Bookman Old Style");

    What is really happening is the FontListTool will be cast to a ComboBoxTool and the call will be valid.  You can also cast it yourself to see all the properties and methods available.

Children