win8/Metro开发系列一 Xaml布局

首先要懂得一些基础的布局知识,这样在开发的过程中才能游刃有余.

布局主要写到xam里面,在xaml基本的主要涉及到三个布局控件Canvas,StackPanel,Grid

概括起来很简单

1.Canvas就是根据坐标、大小进行绝对定位布局。

示例代码

1 <Canvas>
2             <Button Canvas.Left="28" Canvas.Top="26" Content="Button" Height="45" Width="92" />
3 </Canvas>

 

Canvas.Top属性指定控件左上角的纵坐标; Canvas.Left属性指定控件左上角的横坐标。

由于Canvas是绝对定位我没怎么用过只简单的说下 ,用的最多的还是他的z-index的附加属性;

补充:代码设置TopLeft等附加属性的方法:Canvas.SetTop
 
2.StackPanel是把子控件横向或者纵向排列。用Orientation属性设定排列方向:Horizontal(水平)、Vertical(纵向,默认)
示例代码:
View Code

3.Grid他类似于html的<Table></Table>标签,由于我是从web开发转过来的所以特别喜欢它,基本上和table类似由行和列构成的

<RowDefinition ><ColumnDefinition >可以用这俩属性类定义他的行和列,并用Grid.Row,Grid.Column附加属性,来设置grid容器里的空间位于哪行哪列,Grid.RowSpan等可以用来跨行列,总之很方面

注:在用来定义行列大小高度的时候还可以用百分比,稍微变动不是加%而是用*,默认width=“1*”是平分高了分得多少了分的少可以自己去感受下同时*是表示剩下的全部,Auto:自动

此外这些基本布局控件,都是容器,就像你的web开发中的div就Ok了~还会有一个一开始我经常犯得错误!就是button的content属性他是Object类型想对里装俩控件会报错说存在重复的属性,其实想通了很简单你给content赋值给他同时赋俩值它没那么智能不知道你到底想给他赋什么所以就报错了,这时你只需要给他一个容器包裹着再赋给它就Ok了!

下面闲话少扯泳用这些基本的控件来布局一个

这是做的项目的第一页截图接下来就看其简单的实现,这是一开始尝试做的没用样式和资源比较繁琐和乱套,下节用样式和资源来重构一下,不过对练布局还好吧

代码示例:

复制代码
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition ></RowDefinition>
            <RowDefinition Height="3.5*"></RowDefinition>
            <RowDefinition ></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition ></ColumnDefinition>
            <ColumnDefinition Width="8*"></ColumnDefinition>
            <ColumnDefinition ></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <TextBlock Text="妙笔生花" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="50,60,0,0" FontSize="48"></TextBlock>
        <Grid Grid.Column="1" Grid.Row="1" Name="auto">
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            <Button  Grid.Row="0" Grid.Column="0" Click="OnClick">
                <Button.Content>
                    <ContentControl>
                        <Grid >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="4*" ></RowDefinition>
                                <RowDefinition></RowDefinition>
                            </Grid.RowDefinitions>
                            <Image Source="Images/Grop_Item00.jpg" Grid.RowSpan="2" ></Image>
                            <Image Grid.Row="1" Source="Images/11.png"></Image>
                            <TextBlock Text="电脑对联生成器"   Grid.Row="1" FontSize="30" HorizontalAlignment="Center">
                                <TextBlock.Foreground>
                                    <ImageBrush ImageSource="Images/background.png">
                                    </ImageBrush>
                                </TextBlock.Foreground>
                            </TextBlock>
                        </Grid>
                    </ContentControl>
                </Button.Content>
            </Button>
            <Button  Grid.Row="0" Grid.Column="1" Click="OndicClick">
                <Button.Content>
                    <ContentControl>
                        <Grid >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="4*" ></RowDefinition>
                                <RowDefinition></RowDefinition>
                            </Grid.RowDefinitions>
                            <Image Source="Images/Grop_Item10.jpg" Grid.RowSpan="2" ></Image>
                            <Image Grid.Row="1" Source="Images/11.png"></Image>
                            <TextBlock Text="中华大字典"   Grid.Row="1" FontSize="30" HorizontalAlignment="Center"  >
                                <TextBlock.Foreground>
                                    <ImageBrush ImageSource="Images/backGround.png">
                                    </ImageBrush>
                                </TextBlock.Foreground>
                            </TextBlock>
                        </Grid>
                    </ContentControl>
                </Button.Content>
            </Button>
            <Button  Grid.Row="0" Grid.Column="2">
                <Button.Content>
                    <ContentControl>
                        <Grid >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="4*" ></RowDefinition>
                                <RowDefinition></RowDefinition>
                            </Grid.RowDefinitions>
                            <Image Source="Images/Grop_Item02.jpg" Grid.RowSpan="2" ></Image>
                            <Image Grid.Row="1" Source="Images/11.png"></Image>
                            <TextBlock Text="诗歌生成器"   Grid.Row="1" FontSize="30" HorizontalAlignment="Center"  >
                                <TextBlock.Foreground>
                                    <ImageBrush ImageSource="Images/backGround.png">
                                    </ImageBrush>
                                </TextBlock.Foreground>
                            </TextBlock>
                        </Grid>
                    </ContentControl>
                </Button.Content>
            </Button>
            <Button  Grid.Row="1" Grid.Column="0">
                <Button.Content>
                    <ContentControl>
                        <Grid >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="4*" ></RowDefinition>
                                <RowDefinition></RowDefinition>
                            </Grid.RowDefinitions>
                            <Image Source="Images/Grop_Item01.jpg" Grid.RowSpan="2" ></Image>
                            <Image Grid.Row="1" Source="Images/11.png"></Image>
                            <TextBlock Text="趣味经典对联"   Grid.Row="1" FontSize="30" HorizontalAlignment="Center"  >
                                <TextBlock.Foreground>
                                    <ImageBrush ImageSource="Images/backGround.png">
                                    </ImageBrush>
                                </TextBlock.Foreground>
                            </TextBlock>
                        </Grid>
                    </ContentControl>
                </Button.Content>
            </Button>
            <Button  Grid.Row="1" Grid.Column="1" Click="OnPoetryClick">
                <Button.Content>
                    <ContentControl>
                        <Grid >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="4*" ></RowDefinition>
                                <RowDefinition></RowDefinition>
                            </Grid.RowDefinitions>
                            <Image Source="Images/Grop_Item11.jpg" Grid.RowSpan="2" ></Image>
                            <Image Grid.Row="1" Source="Images/11.png"></Image>
                            <TextBlock Text="诗歌大全"   Grid.Row="1" FontSize="30" HorizontalAlignment="Center"  >
                                <TextBlock.Foreground>
                                    <ImageBrush ImageSource="Images/backGround.png">
                                    </ImageBrush>
                                </TextBlock.Foreground>
                            </TextBlock>
                        </Grid>
                    </ContentControl>
                </Button.Content>
            </Button>
            <Button  Grid.Row="1" Grid.Column="2" Click="OnallegoricalClick">
                <Button.Content>
                    <ContentControl>
                        <Grid >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="4*" ></RowDefinition>
                                <RowDefinition></RowDefinition>
                            </Grid.RowDefinitions>
                            <Image Source="Images/Grop_Item12.jpg" Grid.RowSpan="2" ></Image>
                            <Image Grid.Row="1" Source="Images/11.png"></Image>
                            <TextBlock Text="歇后语大全"   Grid.Row="1" FontSize="30" HorizontalAlignment="Center"  >
                                <TextBlock.Foreground>
                                    <ImageBrush ImageSource="Images/backGround.png">
                                    </ImageBrush>
                                </TextBlock.Foreground>
                            </TextBlock>
                        </Grid>
                    </ContentControl>
                </Button.Content>
            </Button>
        </Grid>
    </Grid>
复制代码

仅个人意见,初学还有很多不懂欢迎大家批评指导

本 PPT 介绍了制药厂房中供配电系统的总体概念与设计要点,内容包括: 洁净厂房的特点及其对供配电系统的特殊要求; 供配电设计的般原则与依据的国家/行业标准; 从上级电网到工厂变电所、终端配电的总体结构与模块化设计思路; 供配电范围:动力配电、照明、通讯、接地、防雷与消防等; 动力配电中电压等级、接地系统形式(如 TN-S)、负荷等级与可靠性、UPS 配置等; 照明的电源方式、光源选择、安装方式、应急与备用照明要求; 通讯系统、监控系统在生产管理与消防中的作用; 接地与等电位连接、防雷等级与防雷措施; 消防设施及其专用供电(消防泵、排烟风机、消防控制室、应急照明等); 常见高压柜、动力柜、照明箱等配电设备案例及部分设计图纸示意; 公司已完成的典型项目案例。 1. 工程背景与总体框架 所属领域:制药厂房工程的公用工程系统,其中本 PPT 聚焦于供配电系统。 放在整个公用工程中的位置:与给排水、纯化水/注射用水、气体与热力、暖通空调、自动化控制等系统并列。 2. Part 01 供配电概述 2.1 洁净厂房的特点 空间密闭,结构复杂、走向曲折; 单相设备、仪器种类多,工艺设备昂贵、精密; 装修材料与工艺材料种类多,对尘埃、静电等更敏感。 这些特点决定了:供配电系统要安全可靠、减少积尘、便于清洁和维护。 2.2 供配电总则 供配电设计应满足: 可靠、经济、适用; 保障人身与财产安全; 便于安装与维护; 采用技术先进的设备与方案。 2.3 设计依据与规范 引用了大量俄语标准(ГОСТ、СНиП、SanPiN 等)以及国家、行业和地方规范,作为设计的法规基础文件,包括: 电气设备、接线、接地、电气安全; 建筑物电气装置、照明标准; 卫生与安全相关规范等。 3. Part 02 供配电总览 从电源系统整体结构进行总览: 上级:地方电网; 工厂变电所(10kV 配电装置、变压
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值