I created a Grid to layout my component. I set the borderthickness to 1 pixel in order to get a 1-pixel-border Grid. However, the border looks more thick than my expectation. The borders are 2 pixel wide except the borders around the Grid.
Solution:
I tried many ways to get my 1-pixel-border Grid. For example, I set the left and top borders’ thickness of Grid to 0, the bottom and right borders’ thickness of cell to 0. At last, I got a Grid whoes left and top border is invisible.
Thank God! Casually, I was lighted like a bulb when I saw the “horizontalGap” and “verticalGap” styles of Grid. I set the values of both of them to “-1”. Uh-huh, a 1-pixel-border Grid appeared.
The following is full source code of OnePixelBorder.mxml:
Download: OnePixelBorder.mxml
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
- <mx:Style>
- Grid
- {
- horizontal-gap:-1;
- vertical-gap:-1;
- }
- GridItem
- {
- border-color:#000000;
- border-style:solid;
- border-thickness:1;
- }
- </mx:Style>
- <mx:Grid x="31" y="24">
- <mx:GridRow>
- <mx:GridItem width="100" height="30">
- </mx:GridItem>
- <mx:GridItem width="100" height="30">
- </mx:GridItem>
- <mx:GridItem width="100" colSpan="2" height="30">
- </mx:GridItem>
- </mx:GridRow>
- <mx:GridRow>
- <mx:GridItem width="100" height="30">
- </mx:GridItem>
- <mx:GridItem width="120" colSpan="2" height="30">
- </mx:GridItem>
- <mx:GridItem width="100" colSpan="3" height="11">
- </mx:GridItem>
- </mx:GridRow>
- <mx:GridRow>
- <mx:GridItem width="100" height="30">
- </mx:GridItem>
- <mx:GridItem width="100" height="30">
- </mx:GridItem>
- <mx:GridItem width="120" colSpan="3" height="30">
- </mx:GridItem>
- </mx:GridRow>
- </mx:Grid>
- </mx:Application>
Enjoy!

October 13th, 2008
Ntt.cc 








Posted in
Tags: 
RSS Feed
Email Feed
thanks a lot..
Great! Thank you~
Thanks! This also works with HBoxes/VBoxes…