通过 AS3 设置组合框文本格式 [英] ComboBox Text Formatting through AS3

查看:28
本文介绍了通过 AS3 设置组合框文本格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 AIR 应用程序,我需要更改下拉列表中显示的文本以及组合框上的主要文本的字体大小.我的 ComboBox 很大,但里面显示的文字很小.我尝试通过将 TextFormat 传递给 setStyle 方法,例如:

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);

但是没有用.尽管相同的方法适用于 TextField.

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

有人可以帮忙吗?

推荐答案

A ComboBox 是一个包含 textField 和一个 dropdown 组件.您需要将 "styles" 应用到 ComboBox 内的特定组件:

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);

这篇关于通过 AS3 设置组合框文本格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆