flex设计报表、表格的复杂表头(类似报表的斜线表头)


 

 [Flash/ActionScript/Flex]代码

 

 

<?xml version="1.0" encoding="utf-8"?> 
 
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"  
 
    creationComplete="init()"> 
 
    <mx:Script> 
 
        <![CDATA[
 
            import mx.events.ResizeEvent;
 
            import mx.controls.Label;
 
            
 
            private const leftText:String = "月份";
 
            private const rightText:String = "户型";
 
            
 
            private var leftLabel:Label;
 
            private var rightLabel:Label;
 
            
 
            private function init():void{
 
                addLabel();
 
                drawLine();             
 
                this.addEventListener(ResizeEvent.RESIZE, onResize);
 
            }
 
            
 
            private function onResize(e:ResizeEvent):void{
 
                resetLabel();
 
                drawLine();
 
            }
 
            
 
            private function drawLine():void{
 
                var g:Graphics = this.graphics;
 
                g.clear();
 
                g.lineStyle(0.5, 0xB7BABC);
 
                g.moveTo(0, 0);
 
                g.lineTo(this.width, this.height);
 
            }
 
            
 
            private function addLabel():void{
 
                leftLabel = new Label();
 
                leftLabel.text = leftText;
 
                addChild(leftLabel);
 
                
 
                rightLabel = new Label();
 
                rightLabel.text = rightText;
 
                addChild(rightLabel);
 
                
 
                callLater(resetLabel);
 
            }
 
            
 
            private function resetLabel():void{
 
                leftLabel.x = 5;
 
                leftLabel.y = this.height - leftLabel.height - 5;
 
                rightLabel.x = this.width - rightLabel.width;
 
                rightLabel.y = 10;
 
            }
 
        ]]> 
 
    </mx:Script>   
 
</mx:Canvas> 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值