Flex中如何利用swatchGridBackgroundColor样式设置ColorPicker的样本颜色网格背景颜色的例子

By Minidxer | January 20, 2009

接下来的例子演示了Flex中如何利用swatchGridBackgroundColor样式,设置ColorPicker的样本颜色网格背景颜色。

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


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

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  3.         layout="vertical"
  4.         verticalAlign="top"
  5.         backgroundColor="white"
  6.         creationComplete="init();">
  7.  
  8.     <mx:Style>
  9.         .myCustomSwatchPanelStyleName {
  10.             /* border */
  11.             swatchBorderColor: white;
  12.             swatchBorderSize: 1;
  13.  
  14.             /* highlight */
  15.             swatchHighlightColor: black;
  16.             swatchHighlightSize: 2;
  17.  
  18.             /* gap */
  19.             horizontalGap: 2;
  20.             verticalGap: 2;
  21.  
  22.             /* background */
  23.             swatchGridBackgroundColor: red;
  24.         }
  25.     </mx:Style>
  26.  
  27.     <mx:Form>
  28.         <mx:FormItem label="default:">
  29.             <mx:ColorPicker />
  30.         </mx:FormItem>
  31.         <mx:FormItem label="horizontalGap/verticalGap = 2:">
  32.             <mx:ColorPicker id="colorPicker"
  33.                     swatchPanelStyleName="myCustomSwatchPanelStyleName" />
  34.         </mx:FormItem>
  35.     </mx:Form>
  36.  
  37. </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: ColorPicker | No Comments » | 301 views Tags: , , , ,

Search Posts