wpf 计算器布局练习
先看一下windows自带计算机的布局:
大概布局能看出,有菜单栏(menu),有显示框(textbox),然后剩下的6行5列的布局
先看下代码:
<StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBox Name="xianshi" Text="显示框" Height="50" Margin="5,5,5,5"></TextBox>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Grid.Row="0" Grid.Column="0" Content="MC" Margin="5"></Button>
<Button Grid.Row="0" Grid.Column="1" Content="MR" Margin="5"></Button>
<Button Grid.Row="0" Grid.Column="2" Content="MS" Margin="5"></Button>
<Button Grid.Row="0" Grid.Column="3" Content="M+" Margin="5"></Button>
<Button Grid.Row="0" Grid.Column="4" Content="M-" Margin="5"></Button> <Button Grid.Row="1" Grid.Column="0" Content="←" Margin="5"></Button>
<Button Grid.Row="1" Grid.Column="1" Content="CE" Margin="5"></Button>
<Button Grid.Row="1" Grid.Column="2" Content="C" Margin="5"></Button>
<Button Grid.Row="1" Grid.Column="3" Content="±" Margin="5"></Button>
<Button Grid.Row="1" Grid.Column="4" Content="√" Margin="5"></Button> <Button Grid.Row="2" Grid.Column="0" Content="7" Margin="5"></Button>
<Button Grid.Row="2" Grid.Column="1" Content="8" Margin="5"></Button>
<Button Grid.Row="2" Grid.Column="2" Content="9" Margin="5"></Button>
<Button Grid.Row="2" Grid.Column="3" Content="/" Margin="5"></Button>
<Button Grid.Row="2" Grid.Column="4" Content="%" Margin="5"></Button> <Button Grid.Row="3" Grid.Column="0" Content="4" Margin="5"></Button>
<Button Grid.Row="3" Grid.Column="1" Content="5" Margin="5"></Button>
<Button Grid.Row="3" Grid.Column="2" Content="6" Margin="5"></Button>
<Button Grid.Row="3" Grid.Column="3" Content="*" Margin="5"></Button>
<Button Grid.Row="3" Grid.Column="4" Content="1/x" Margin="5"></Button> <Button Grid.Row="4" Grid.Column="0" Content="1" Margin="5"></Button>
<Button Grid.Row="4" Grid.Column="1" Content="2" Margin="5"></Button>
<Button Grid.Row="4" Grid.Column="2" Content="3" Margin="5"></Button>
<Button Grid.Row="4" Grid.Column="3" Content="-" Margin="5"></Button>
<Button Grid.Row="4" Grid.Column="4" Content="=" Grid.RowSpan="2" Margin="5"></Button> <Button Grid.Row="5" Grid.Column="0" Content="0" Grid.ColumnSpan="2" Margin="5"></Button> <Button Grid.Row="5" Grid.Column="2" Content="." Margin="5"></Button>
<Button Grid.Row="5" Grid.Column="3" Content="+" Margin="5"></Button> </Grid>
</StackPanel>
</DockPanel>
看下生成的结果:
虽然还差了点,但是继续努力吧。。。继续学习。。
wpf 计算器布局练习的更多相关文章
- C# WPF计算器界面(Calculator Design With Animations)
时间如流水,只能流去不流回! 点赞再看,养成习惯,这是您给我创作的动力! 本文 Dotnet9 https://dotnet9.com 已收录,站长乐于分享dotnet相关技术,比如Winform.W ...
- WPF 之 布局(一)
WPF的布局控件都在 System.Windows.Controls.Panel 这个基类下面,使用 WPF提供的各种控件在WPF应用程序中界面进行布局,同时对各种子控件(如按钮.文本框,下拉框等)进 ...
- WPF简单布局 浅尝辄止
WPF的窗口只能包含一个元素,为了在WPF窗口中放置多个元素并创建更实用的用户界面,需要在窗口上放置一个容器,然后在容器中放置其它元素. 注意:造成这一限制的原因是window类继承自 ...
- WPF UI布局之概述
在线演示:http://v.youku.com/v_show/id_XNzA5NDk2Mjcy.html 清晰版视频+代码下载:http://115.com/lb/5lbeer0m9lad 一.简单介 ...
- WPF(布局)
WPF编程学习——布局 本文目录 1.布局简介 2.面板(Panel) 3.视图框(Viewbox) 4.滚动视图控件(ScrollViewer) 5.公共布局属性 1.布局简介 应用程序界面 ...
- Wpf之布局
Wpf之布局 上一章大家有了自己的一个Hello World的wpf程序,今天咱们就一起走进WPF,一起来看看wpF的前台xaml这门语言的魅力. 写过web 的人都知道布局这个概念,在web中布局和 ...
- WPF常用布局介绍
概述:本文简要介绍了WPF中布局常用控件及布局相关的属性 1 Canvas Canvas是一个类似于坐标系的面板,所有的元素通过设置坐标来决定其在坐标系中的位置..具体表现为使用Left.Top.Ri ...
- wpf(布局与Canvas )
WPF的布局有控件都在System.Windows.Controls.Panel这个基类下面,常见的布局控件: . canvas: Canvas是最基本的面板,它不会自动调整内部元素的排列及大小,它仅 ...
- 【WPF】 布局篇
[WPF] 布局篇 一. 几个常用且至关重要的属性 1. Width,Height : 设置窗体,控件宽高. 这里注意,WPF是自适应的, 所以把这2个属性设置 Auto, 则控件宽高会自动改变. 2 ...
随机推荐
- 对于Unicode编码在js中和html中
1.对于Unicode在js中 var a="\u9102WQW121" 中"\"是需要转义的,直接在页面输出的效果
- ruby mysql数据库操作
require 'mysql' con=Mysql.new('localhost','root','root','test') con.query('set names utf8') rs=con.q ...
- hadoop2.2编程:用ruby跑hadoop的完整实例
Becareful! All nodes include need to install ruby! #!/usr/bin/ruby # Ruby code for map.rb ARGF.eac ...
- [OpenJudge] 平方和
平方和 总时间限制: 3000ms 内存限制: 65536kB 描述 给出n(1<=n<=500000)个数字,下标从1开始 执行m(1<=m<=500000)次操作,操作可分 ...
- apache开源项目--gora
Gora 是一个应用于 NoSQL 数据库的 ORM 框架,支持包括:Apache HBase/Apache Cassandra
- MsoShapeType /InlineShape枚举
指定形状的类型或形状范围. 名称 值 说明 msoAutoShape 1 自选图形. msoCallout 2 标注. msoCanvas 20 画布. msoChart 3 图. msoCommen ...
- ActiveX添加测试工程, 出现的问题[非选择性参数][找不到成员]
ActiveX 添加测试工程 1.新建工程MFC application, 2.添加完毕,在main Dialog中, 右键[Insert Activex Control],选择你的ActiveX控件 ...
- [liu yanling]软件开发的过程按阶段划分有:单元测试 集成测试 系统测试 验收测试
从软件开发的过程按阶段划分有:单元测试 集成测试 系统测试 验收测试测试过程按 4 个步骤进行,概念内容如下:单元测试:单元测试是对软件基本组成单元(如函数.类的方法等)进行的测试.集成测试:集成测试 ...
- LCD platform_device(s5pv210)
devs.c: static struct resource s3cfb_resource[] = { [0] = { .start= S5P_PA_LCD, .end= S5P_PA_LCD + ...
- 【wuzhicms】apache 设置禁止访问某些文件或目录
[apache配置禁止访问] 1. 禁止访问某些文件/目录 增加Files选项来控制,比如要不允许访问 .inc 扩展名的文件,保护php类库: <Files ~ "\.inc$&qu ...