欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

设置ComboBox控件的小箭头颜色.

发布时间:2023/12/18 编程问答 38 豆豆
生活随笔 收集整理的这篇文章主要介绍了 设置ComboBox控件的小箭头颜色. 小编觉得挺不错的,现在分享给大家,帮大家做个参考.
ComboBox控件的iconColor样式. 示例:

代码:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/07/03/setting-the-icon-color-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:Object label="Seven" />
        
<mx:Object label="Eight" />
        
<mx:Object label="Nine" />
        
<mx:Object label="Ten" />
    
</mx:Array>

    
<mx:ApplicationControlBar dock="true">
        
<mx:Form styleName="plain">
            
<mx:FormItem label="iconColor:">
                
<mx:ColorPicker id="colorPicker" />
            
</mx:FormItem>
        
</mx:Form>
    
</mx:ApplicationControlBar>

    
<mx:ComboBox id="comboBox"
            dataProvider
="{arr}"
            iconColor
="{colorPicker.selectedColor}" />

</mx:Application>

也可以通过CSS设置:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/07/03/setting-the-icon-color-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 {
            iconColor: red;
        }
    
</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:Object label="Seven" />
        
<mx:Object label="Eight" />
        
<mx:Object label="Nine" />
        
<mx:Object label="Ten" />
    
</mx:Array>

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

</mx:Application>

也可以通过as的方法实现:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/07/03/setting-the-icon-color-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[
            import mx.events.ColorPickerEvent;

            private function colorPicker_change(evt:ColorPickerEvent):void {
                comboBox.setStyle("iconColor", evt.color);
            }
        
]]>
    
</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:Object label="Seven" />
        
<mx:Object label="Eight" />
        
<mx:Object label="Nine" />
        
<mx:Object label="Ten" />
    
</mx:Array>

    
<mx:ApplicationControlBar dock="true">
        
<mx:Form styleName="plain">
            
<mx:FormItem label="iconColor:">
                
<mx:ColorPicker id="colorPicker"
                        change
="colorPicker_change(event);" />
            
</mx:FormItem>
        
</mx:Form>
    
</mx:ApplicationControlBar>

    
<mx:ComboBox id="comboBox"
            dataProvider
="{arr}"
            iconColor
="{colorPicker.selectedColor}" />

</mx:Application>

转载于:https://www.cnblogs.com/xxcainiao/archive/2008/07/14/1242555.html

总结

以上是生活随笔为你收集整理的设置ComboBox控件的小箭头颜色.的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。