Flex中如何利用borderThicknessLeft, borderThicknessRight, borderThicknessTop和borderThicknessBottom样式设置Panel容器各边框厚度的例子
By Minidxer | February 21, 2009
接下来的例子演示了Flex中如何利用borderThicknessLeft, borderThicknessRight, borderThicknessTop和borderThicknessBottom样式,设置Panel容器各边框厚度。
让我们先来看一下Demo(可以右键View Source或点击这里察看源代码):
下面是完整代码(或点击这里察看):
Download: main.mxml
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
- layout="vertical"
- verticalAlign="middle"
- backgroundColor="white">
- <mx:Style>
- .nakedButton {
- skin: ClassReference(null);
- }
- </mx:Style>
- <mx:ApplicationControlBar dock="true">
- <mx:Form styleName="plain">
- <mx:FormItem label="borderThicknessLeft:"
- direction="horizontal">
- <mx:HSlider id="sliderLeft"
- minimum="0"
- maximum="50"
- value="10"
- snapInterval="1"
- tickInterval="10"
- liveDragging="true" />
- <mx:Label text="{sliderLeft.value}" />
- </mx:FormItem>
- <mx:FormItem label="borderThicknessRight:"
- direction="horizontal">
- <mx:HSlider id="sliderRight"
- minimum="0"
- maximum="50"
- value="10"
- snapInterval="1"
- tickInterval="10"
- liveDragging="true" />
- <mx:Label text="{sliderRight.value}" />
- </mx:FormItem>
- <mx:FormItem label="borderThicknessTop:"
- direction="horizontal">
- <mx:HSlider id="sliderTop"
- minimum="0"
- maximum="50"
- value="0"
- snapInterval="1"
- tickInterval="10"
- liveDragging="true" />
- <mx:Label text="{sliderTop.value}" />
- </mx:FormItem>
- <mx:FormItem label="borderThicknessBottom:"
- direction="horizontal">
- <mx:HSlider id="sliderBottom"
- minimum="0"
- maximum="50"
- value="10"
- snapInterval="1"
- tickInterval="10"
- liveDragging="true" />
- <mx:Label text="{sliderBottom.value}" />
- </mx:FormItem>
- </mx:Form>
- </mx:ApplicationControlBar>
- <mx:Panel id="panel"
- title="The quick brown fox jumped over the lazy dog."
- borderThicknessLeft="{sliderLeft.value}"
- borderThicknessRight="{sliderRight.value}"
- borderThicknessTop="{sliderTop.value}"
- borderThicknessBottom="{sliderBottom.value}"
- layout="absolute"
- width="100%" height="100%">
- <mx:Button label="borderThicknessLeft"
- labelPlacement="right"
- icon="@Embed('assets/arrow_left.png')"
- styleName="nakedButton"
- left="0"
- verticalCenter="0"
- toolTip="{sliderLeft.value}"
- errorString="{sliderLeft.value}" />
- <mx:Button label="borderThicknessRight"
- labelPlacement="left"
- icon="@Embed('assets/arrow_right.png')"
- styleName="nakedButton"
- right="0"
- verticalCenter="0" />
- <mx:Button label="borderThicknessTop"
- labelPlacement="bottom"
- icon="@Embed('assets/arrow_up.png')"
- styleName="nakedButton"
- top="0"
- horizontalCenter="0" />
- <mx:Button label="borderThicknessBottom"
- labelPlacement="top"
- icon="@Embed('assets/arrow_down.png')"
- styleName="nakedButton"
- bottom="0"
- horizontalCenter="0" />
- </mx:Panel>
- </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子
Topics:
Panel |
No Comments » |
Tags: borderThicknessBottom, borderThicknessLeft, borderThicknessRight, borderThicknessTop, Panel