改变ComboBox控件的背景填充色。

ComboBox控件的fillColors样式。
示例:


代码:

<? xml version = " 1.0 "  encoding = " utf-8 " ?>
<!--  http: // blog.flexexamples.com/2008/06/14/changing-the-background-fill-colors-on-a-combobox-control-in-flex/ -->
< mx:Application xmlns:mx = " http://www.adobe.com/2006/mxml "
        layout
= " vertical "
        verticalAlign
= " top "
        backgroundColor
= " white " >

    
< mx:Array id = " arr " >
        
< mx:Object label = " One "   />
        
< mx:Object label = " Two "   />
        
< mx:Object label = " Three "   />
        
< mx:Object label = " Four "   />
        
< mx:Object label = " Five "   />
        
< mx:Object label = " Six "   />
    
</ mx:Array >

    
< mx:ComboBox id = " comboBox "
            dataProvider
= " {arr} "
            fillColors
= " [red, haloOrange] "   />

</ mx:Application >

还可以通过CSS来修改:
<? xml version = " 1.0 "  encoding = " utf-8 " ?>
<!--  http: // blog.flexexamples.com/2008/06/14/changing-the-background-fill-colors-on-a-combobox-control-in-flex/ -->
< mx:Application xmlns:mx = " http://www.adobe.com/2006/mxml "
        layout
= " vertical "
        verticalAlign
= " top "
        backgroundColor
= " white " >

    
< mx:Style >
        ComboBox {
            fillColors: red, haloOrange;
        }
    
</ mx:Style >

    
< mx:Array id = " arr " >
        
< mx:Object label = " One "   />
        
< mx:Object label = " Two "   />
        
< mx:Object label = " Three "   />
        
< mx:Object label = " Four "   />
        
< mx:Object label = " Five "   />
        
< mx:Object label = " Six "   />
    
</ mx:Array >

    
< mx:ComboBox id = " comboBox "
            dataProvider
= " {arr} "   />

</ mx:Application >

也可以通过AS来实现:
<? xml version="1.0" encoding="utf-8" ?>
<!--  http://blog.flexexamples.com/2008/06/14/changing-the-background-fill-colors-on-a-combobox-control-in-flex/  -->
< mx:Application  xmlns:mx ="http://www.adobe.com/2006/mxml"
        layout
="vertical"
        verticalAlign
="top"
        backgroundColor
="white" >

    
< mx:Script >
        
<![CDATA[
            private function init():void {
                comboBox.setStyle("fillColors", ["red", "haloOrange"]);
            }
        
]]>
    
</ mx:Script >

    
< mx:Array  id ="arr" >
        
< mx:Object  label ="One"   />
        
< mx:Object  label ="Two"   />
        
< mx:Object  label ="Three"   />
        
< mx:Object  label ="Four"   />
        
< mx:Object  label ="Five"   />
        
< mx:Object  label ="Six"   />
    
</ mx:Array >

    
< mx:ComboBox  id ="comboBox"
            dataProvider
=" {arr} "
            creationComplete
="init();"   />

</ mx:Application >

转载于:https://www.cnblogs.com/xxcainiao/archive/2008/06/16/1222920.html

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 扫一扫,分享海报

表情包
插入表情
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
©️2022 CSDN 皮肤主题:编程工作室 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值