ComboBox Text Formatting through AS3

人盡茶涼 提交于 2019-12-31 01:11:09

问题


I am developing an AIR application and I need to change the font size of the text that is displayed in the dropDown List as well as the main text on the comboBox. My ComboBox is quite big in size but the text displayed in it is very small. I tried using the setStyle method by passing a TextFormat into it like :

cmbEmployee.setStyle("textFormat", txtform);

but it didn't work. Although the same method works well with a TextField.

Can somebody help ?


回答1:


A ComboBox is a container that contains a textField and a dropdown component. You need to apply the "styles" to the specific components inside of the ComboBox:

// Text Formats that needs to be applied on your comboBox
var txtformat:TextFormat = new TextFormat(); 
    txtformat.size = 30;   // Lets just increase the size of fonts   

// Increase the main TextField's font size of your ComboBox
yourComboBox.textField.setStyle("textFormat", txtformat);

// Increase the font size to the dropdown component
yourComboBox.dropdown.setRendererStyle("textFormat", txtformat);


来源:https://stackoverflow.com/questions/16311141/combobox-text-formatting-through-as3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!