设置ComboBox控件的边框颜色.
2008-06-11 13:03
471 查看
ComboBox控件的borderColor样式学习.
示例:
代码:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/06/09/setting-a-border-color-on-the-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:ApplicationControlBar dock="true">
<mx:Form styleName="plain">
<mx:FormItem label="borderColor:">
<mx:ColorPicker id="colorPicker" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<mx:ComboBox id="comboBox"
dataProvider="{arr}"
borderColor="{colorPicker.selectedColor}" />
</mx:Application>
也可以通过css实现:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/06/09/setting-a-border-color-on-the-combobox-control-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="top"
backgroundColor="white">
<mx:Style>
ComboBox {
borderColor: 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:Array>
<mx:ComboBox id="comboBox"
dataProvider="{arr}" />
</mx:Application>
也可以通过AS的内部函数实现
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/06/09/setting-a-border-color-on-the-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("borderColor", 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:Array>
<mx:ApplicationControlBar dock="true">
<mx:Form styleName="plain">
<mx:FormItem label="borderColor:">
<mx:ColorPicker id="colorPicker"
change="colorPicker_change(event);" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<mx:ComboBox id="comboBox"
dataProvider="{arr}" />
</mx:Application>
示例:
代码:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/06/09/setting-a-border-color-on-the-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:ApplicationControlBar dock="true">
<mx:Form styleName="plain">
<mx:FormItem label="borderColor:">
<mx:ColorPicker id="colorPicker" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<mx:ComboBox id="comboBox"
dataProvider="{arr}"
borderColor="{colorPicker.selectedColor}" />
</mx:Application>
也可以通过css实现:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/06/09/setting-a-border-color-on-the-combobox-control-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="top"
backgroundColor="white">
<mx:Style>
ComboBox {
borderColor: 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:Array>
<mx:ComboBox id="comboBox"
dataProvider="{arr}" />
</mx:Application>
也可以通过AS的内部函数实现
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/06/09/setting-a-border-color-on-the-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("borderColor", 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:Array>
<mx:ApplicationControlBar dock="true">
<mx:Form styleName="plain">
<mx:FormItem label="borderColor:">
<mx:ColorPicker id="colorPicker"
change="colorPicker_change(event);" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<mx:ComboBox id="comboBox"
dataProvider="{arr}" />
</mx:Application>
相关文章推荐
- Flex中通过设定borderColor样式给ComboBox控件设置边框颜色的例子
- iOS 中使用xib创建的控件边框和颜色等设置
- Qt Designer控件背景颜色及边框设置
- android设置控件样式(边框颜色,圆角)和图片样式(圆角)
- ios之如何让图片显示成圆形的样式/设置控件边框大小以及颜色
- 设置NumericStepper控件文本区的边框颜色。
- 代码设置TextView、Button等控件圆角边框背景颜色
- iOS xib或storyborad中给UI控件设置边框颜色
- Flex中通过设置fillColors样式改变ComboBox控件的填充背景颜色的例子
- 设置UI控件的Layer属性(边框可见,边框颜色,边框宽度,边框圆角)
- 设置ComboBox控件的小箭头颜色.
- Flex中通过borderColor样式设置NumericStepper控件边框颜色的例子
- Flex中如何通过borderColor样式设置DateField控件边框颜色的例子
- CListCtrl 控件设置背景颜色、字体背景颜色、字体颜色
- UIButton 设置圆角 边框颜色 点击回调方法
- 可设置圆角背景边框的按钮, 通过调节色彩明度自动计算按下(pressed)状态颜色
- ASP.NET中怎样设置table 边框颜色
- div不设置高度背景颜色或外边框不能显示的解决方法
- CSS盒模型--边框设置:border: 1px solid red(像素 样式 颜色 ),border-bottom:1px dotted #ccc
- MFC对话框中控件字体颜色的设置