Flex中如何通过backgroundDisabledColor样式设置无效状态下TextArea控件背景颜色的例子

By Minidxer | August 18, 2008

接下来的例子演示了Flex中如何通过backgroundDisabledColor样式,设置无效状态下TextArea控件背景颜色。

让我们先来看一下Demo可以右键View Source或点击这里察看源代码):


下面是完整代码(或点击这里察看):

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- http://blog.flexexamples.com/2008/08/17/changing-the-background-color-of-a-disabled-textarea-control-in-flex/ -->
  3. <mx:Application name="TextArea_backgroundDisabledColor_test"
  4.         xmlns:mx="http://www.adobe.com/2006/mxml"
  5.         layout="vertical"
  6.         verticalAlign="middle"
  7.         backgroundColor="white">
  8.  
  9.     <mx:String id="lorem" source="lorem.txt" />
  10.  
  11.     <mx:ApplicationControlBar dock="true">
  12.         <mx:Form styleName="plain">
  13.             <mx:FormItem label="backgroundDisabledColor:">
  14.                 <mx:ColorPicker id="colorPicker"
  15.                         selectedColor="#CCCCCC" />
  16.             </mx:FormItem>
  17.             <mx:FormItem label="enabled:">
  18.                 <mx:CheckBox id="checkBox"
  19.                         selected="true" />
  20.             </mx:FormItem>
  21.         </mx:Form>
  22.     </mx:ApplicationControlBar>
  23.  
  24.     <mx:TextArea id="textArea"
  25.             text="{lorem}"
  26.             backgroundDisabledColor="{colorPicker.selectedColor}"
  27.             enabled="{checkBox.selected}"
  28.             width="100%"
  29.             height="100%" />
  30.  
  31. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: Flex | Tags: , , ,

Related Post

Leave a Comment

Name(*):

E-Mail(*) :

Website :

Comments :

Search Posts

Archives

Sponsored Ads