当前位置: 首页 > news >正文

001集—— 创建一个WPF项目 ——WPF应用程序入门 C#

 本例为一个WPF应用(.NET FrameWork)。

首先创建一个项目

 

 双击xaml文件

双击xaml文件进入如下界面,开始编写代码。

效果如下:

 

 付代码:

<Window x:Class="WpfDemoFW.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:local="clr-namespace:WpfDemoFW" mc:Ignorable="d"Title="这是一个WPF的演示" Height="550" Width="600"><Grid ShowGridLines="True" ><Grid.RowDefinitions ><RowDefinition Height=" 30"/><RowDefinition Height=" 30"/><RowDefinition/><RowDefinition Height=" 30"/><RowDefinition Height=" 30"/></Grid.RowDefinitions><StackPanel Grid.Row=" 0" Grid.Column=" 0" Orientation="Horizontal"><Button Width=" 40" Height=" 20" Content=" 文件"  /><Button Width=" 40" Height=" 20" Content=" 编辑" /><Button Width=" 40" Height=" 20" Content=" 视图" /><Button Width=" 40" Height=" 20" Content=" Git(G)" /><Button Width=" 40" Height=" 20" Content="项目" /><Button Width=" 40" Height=" 20" Content="生成" /><Button Width=" 40" Height=" 20" Content="调试" /><Button Width=" 40" Height=" 20" Content="测试" /></StackPanel><StackPanel Grid.Row=" 1" Grid.Column=" 0" Orientation="Horizontal"><Button Width=" 130" Height=" 20" Content="MainWindow.xaml"  HorizontalAlignment="Left"  /><Button Width=" 140" Height=" 20" Content=" MainWindow.xaml.cs" HorizontalAlignment="Right" /></StackPanel><Grid  Grid.Row=" 2" Grid.Column=" 0" Background="CadetBlue" ><Grid.ColumnDefinitions ><ColumnDefinition Width=" 70"/><ColumnDefinition /></Grid.ColumnDefinitions><StackPanel Grid.Column=" 0" Grid.Row=" 0"><Button  Height=" 20" Content="1"/><Button  Height=" 20" Content="2"/><Button  Height=" 20" Content="3"/><Button  Height=" 20" Content="4"/></StackPanel><RichTextBox   Grid.Row=" 0" Grid.Column=" 1"/></Grid><Grid Grid.Row=" 3" Grid.Column=" 0" ><Grid.ColumnDefinitions ><ColumnDefinition /><ColumnDefinition /><ColumnDefinition /><ColumnDefinition /><ColumnDefinition /></Grid.ColumnDefinitions><Button Grid.Column ="0"  Width=" 120" Height=" 20" Content="程序包管理器控制台"  HorizontalAlignment="Left"  /><Button Grid.Column ="1" Width=" 120" Height=" 20" Content="输出"  HorizontalAlignment="Left"  /><Button Grid.Column ="2" Width=" 120" Height=" 20" Content="错误列表"  HorizontalAlignment="Left"  /></Grid><StackPanel Grid.Row=" 4" Grid.Column=" 0" Orientation="Horizontal"><Button Width=" 130" Height=" 20" Content="就绪"  HorizontalAlignment="Left"  /></StackPanel></Grid>
</Window>

http://www.lryc.cn/news/495966.html

相关文章:

  • 【C++】1___引用
  • 如何通过 JWT 来解决登录认证问题
  • 高效集成:将聚水潭数据导入MySQL的实战案例
  • Jenkins-基于 JNLP协议的 Java Web 启动代理
  • Qt数据库操作-QSqlQueryModel 的使用
  • C语言编程1.21波兰国旗问题
  • 如何利用微型5G网关为智慧无人矿车提供精确定位
  • 使用docker-compese部署SFTPGo详解
  • Ajax基础总结(思维导图+二维表)
  • Spring Task和WebSocket使用
  • 微信小程序 本地调试和vconsole可以 但在体验上页面不请求数据
  • QT:将QTableWidget内容写入txt文件中
  • 前端面试题(六)
  • 「Mac畅玩鸿蒙与硬件35」UI互动应用篇12 - 简易日历
  • Leetcode581. 最短无序连续子数组(HOT100)
  • HTML前端开发-- Flex布局详解及实战
  • 基于JWT跨语言开发分布式业务系统的挑战与实践:多语言协作的最佳方案
  • 二分法篇——于上下边界的扭转压缩间,窥见正解辉映之光(2)
  • 什么是 Kata Containers?
  • SpringMvc项目配置RabbitMq
  • shell编程(4)脚本与用户交互以及if条件判断
  • vue2组件跨层级数据共享provide 和 inject
  • springboot/ssm校园闲置物品交易系统ava大学生二手闲置交易平台web二手源码
  • Redis实现限量优惠券的秒杀
  • Linux centOS 7 安装 rabbitMQ
  • 活着就好20241202
  • 自由学习记录(28)
  • 操作系统、虚拟化技术与云原生01
  • linux的挂卸载
  • 【和春笋一起学C++】OpenCV中数组和指针运用实例