加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Flex弹出自定义窗体,并且居中

发布时间:2020-12-15 03:48:18 所属栏目:百科 来源:网络整理
导读:大致就是分两步: (1)先自定义窗体的布局mxml文件showHistoryStatics 比如: mx:Panel title="停车场信息" textAlign="center" width="100%" height="50%" minHeight="10" dropShadowVisible="false" borderColor="#99bbe8" color="#0000FF"s:Group width=

大致就是分两步:

(1)先自定义窗体的布局mxml文件showHistoryStatics 比如:

<mx:Panel title="停车场信息" textAlign="center" width="100%" height="50%"  minHeight="10"
			  dropShadowVisible="false" borderColor="#99bbe8" color="#0000FF">
	<s:Group width="100%" height="4">
	   <s:Line  horizontalCenter="0" width="100%">
		<s:stroke>
		     <s:SolidColorStroke color="#FF8C40" weight="4" caps="square"/>
		</s:stroke>
	   </s:Line>
	</s:Group>
	<s:HGroup width="100%" height="30" verticalAlign="middle" horizontalAlign="center">
		<s:Label text="停车场编号:"/>
		<s:TextInput editable="false" text="{}"/>
		<s:Label text="停车场名称:"/>
		<s:TextInput editable="false" text="{str_time}"/>
	</s:HGroup>
	<s:HGroup width="100%" height="30" verticalAlign="middle" horizontalAlign="center">
		<s:Label text="停车场类型:"/>
		<s:TextInput editable="false" text="{str_code}"/>
		<s:Label text="停车场地址:"/>
		<s:TextInput editable="false" text="{str_code}"/>
	</s:HGroup>
	<s:HGroup width="100%" height="30" verticalAlign="middle" horizontalAlign="center">
		<s:Label text="经营单位名:"/>
		<s:TextInput editable="false" text="{str_code}"/>
		<s:Label text="总车位个数:"/>
		<s:TextInput editable="false" text="{str_code}"/>
	</s:HGroup>
</mx:Panel>

接着要在主窗体中显示:

var add_window:showHistoryStatics=new showHistoryStatics();
add_window.title="停车场统计信息";
PopUpManager.addPopUp(add_window,this,true);
PopUpManager.centerPopUp(add_window);  														

但是只有以上两句有些时候在多层窗口里是不能居中显示的,原因不明

所以要自己手动设定,让其剧中,加上如下两句即可

add_window.x=Capabilities.screenResolutionX/2-add_window.width/2; 
add_window.y=Capabilities.screenResolutionY/2-add_window.height/2;

其中

Capabilities.screenResolutionX 
Capabilities.screenResolutionY

分别是获取当前屏幕的宽高

获取当前窗体的宽高为

add_window.width/2; 
add_window.height/2;

或者直接是

this.height;
this.width;



?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读