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 ...
随机推荐
- 结构体dict_field_t
typedef struct dict_field_struct dict_field_t; typedef struct dict_field_struct dict_field_t; /** Da ...
- 转自 Because of you 的总结
上下界网络流的问题严格的分,可以分为四类吧. 1:无源汇可行流 sgu 194 2:有源汇可行流 poj 2396 这题比较好,我建图建了将近200行 3:有源汇最大流 zoj 3496 这 ...
- apache开源项目--gora
Gora 是一个应用于 NoSQL 数据库的 ORM 框架,支持包括:Apache HBase/Apache Cassandra
- 一步步写STM32 OS【四】OS基本框架
一.上篇回顾 上一篇文章中,我们完成了两个任务使用PendSV实现了互相切换的功能,下面我们接着其思路往下做.这次我们完成OS基本框架,即实现一个非抢占式(已经调度的进程执行完成,然后根据优先级调度等 ...
- LinkedList源码解析
LinkedList是基于链表结构的一种List,在分析LinkedList源码前有必要对链表结构进行说明.1.链表的概念链表是由一系列非连续的节点组成的存储结构,简单分下类的话,链表又分为单向链表和 ...
- OAuth 的权限问题与信息隐忧
核心提示:以 QQ 登陆和微博登陆为代表的“一键登陆”背后不仅仅是登陆这么简单,它还默认获取了你的其他隐私资料和账号的部分使用权限,我们在享受便利的同时一定不要忘记保护好我们的个人信息安全. 去年3Q ...
- C# using Sendkey function to send a key to another application
If notepad is already started, you should write: // import the function in your class [DllImport (&q ...
- HDU-1036 Average is not Fast Enough!
Average is not Fast Enough! http://acm.hdu.edu.cn/showproblem.php?pid=1036 Problem Description A rel ...
- 【原】CAVLC的个人理解
4x4数据块经过预测.变换.量化后,非零系数主要集中在低频部分,而高频部分大部分是零.数据经过zig-zag扫描后,从左->右(低频->高频),DC系数附近的系数非常大,而高频的非零系数大 ...
- ArrayLLis 线程不安 实验
这段代码演示了ArrayList的线程不安全,我让3个线程分别对list加入300个字符串,最后的arr的大小为800多,大家可以测试一下,我的一次是898,一次是897,同时还学了join的用法 i ...