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

电话投放小网站ui设计招聘

电话投放小网站,ui设计招聘,网页设计与网站建设书,xyz域名免费注册开始使用 C# 开发使用的软件Visual Studio 2019 文章所有的代码都放在 https://github.com/hikinazimi/head-first-Csharp 创建一个控制台应用 打开Visual Studio 2019 创建项目 选择控制台应用程序 创建后点击运行,就可以在控制台打印Hello World 构建一个游戏(创建WPF项目…开始使用 C# 开发使用的软件Visual Studio 2019 文章所有的代码都放在 https://github.com/hikinazimi/head-first-Csharp 创建一个控制台应用 打开Visual Studio 2019 创建项目 选择控制台应用程序 创建后点击运行,就可以在控制台打印Hello World 构建一个游戏(创建WPF项目) 构建游戏的步骤 首先创建WPF项目使用XAML构建窗口编写C#代码向这个窗口增加随机的动物表情符号允许用户成对的点击符号配对增加一个计时器 1.创建WPF项目 在MainWindow.xaml文件下打开工具箱 2.使用XAML构建窗口 在xaml文件下使用如下代码创建一个4*4方格的界面 Grid为网格的框架 TextBlock为显示的文字 Window x:ClassMatchGame.MainWindowxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:dhttp://schemas.microsoft.com/expression/blend/2008xmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006xmlns:localclr-namespace:MatchGamemc:IgnorabledTitleFind all of the matching animals Height450 Width400Grid x:NamemainGridGrid.ColumnDefinitionsColumnDefinition /ColumnDefinition /ColumnDefinition /ColumnDefinition //Grid.ColumnDefinitionsGrid.RowDefinitionsRowDefinition /RowDefinition /RowDefinition /RowDefinition /RowDefinition //Grid.RowDefinitionsTextBlock Text? FontSize36 HorizontalAlignmentCenter VerticalAlignmentCenter /TextBlock Text? FontSize36 HorizontalAlignmentCenter VerticalAlignmentCenter Grid.Column1 /TextBlock Text? FontSize36 HorizontalAlignmentCenter VerticalAlignmentCenter Grid.Column2/TextBlock Text? FontSize36 HorizontalAlignmentCenter VerticalAlignmentCenter Grid.Column3/TextBlock Text? FontSize36 HorizontalAlignmentCenter VerticalAlignmentCenter Grid.Row1 /TextBlock Text? FontSize36 Grid.Row1 Grid.Column1HorizontalAlignmentCenter VerticalAlignmentCenter /TextBlock Text? FontSize36 Grid.Row1 Grid.Column2 HorizontalAlignmentCenter VerticalAlignmentCenter /TextBlock Text? FontSize36 Grid.Row1 Grid.Column3 HorizontalAlignmentCenter VerticalAlignmentCenter/TextBlock Text? FontSize36 Grid.Row2 HorizontalAlignmentCenter VerticalAlignmentCenter /TextBlock Text? FontSize36 Grid.Row2 Grid.Column1 HorizontalAlignmentCenter VerticalAlignmentCenter /TextBlock Text? FontSize36 Grid.Row2 Grid.Column2 HorizontalAlignmentCenter VerticalAlignmentCenter /TextBlock Text? FontSize36 Grid.Row2 Grid.Column3 HorizontalAlignmentCenter VerticalAlignmentCenter/TextBlock Text? FontSize36 Grid.Row3 HorizontalAlignmentCenter VerticalAlignmentCenter /TextBlock Text? FontSize36 Grid.Row3 Grid.Column1 HorizontalAlignmentCenter VerticalAlignmentCenter /TextBlock Text? FontSize36 Grid.Row3 Grid.Column2 HorizontalAlignmentCenter VerticalAlignmentCenter /TextBlock Text? FontSize36 Grid.Row3 Grid.Column3 HorizontalAlignmentCenter VerticalAlignmentCenter /TextBlock x:NametimeTextBlock TextElapsed time FontSize36HorizontalAlignmentCenter VerticalAlignmentCenterGrid.Row4 Grid.ColumnSpan4 //Grid/Window 打开.cs文件,这是程序逻辑代码实现的地方 3.编写C#代码向这个窗口增加随机的动物表情符号 然后再.cs文件下输入如下代码 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes;namespace MatchGame {/// summary/// MainWindow.xaml 的交互逻辑/// /summarypublic partial class MainWindow : Window{public MainWindow(){InitializeComponent();SetUpGame();}private void SetUpGame(){Liststring animalEmoji new Liststring()//创建表情列表{,,, ,,,, ,,,,,, ,, ,};Random random new Random();//mainGrid位xaml中grid的标签名,如Grid x:NamemainGridforeach (TextBlock textBlock in mainGrid.Children.OfTypeTextBlock()){int index random.Next(animalEmoji.Count);string nextEmoji animalEmoji[index];textBlock.Text nextEmoji;animalEmoji.RemoveAt(index);}}} } 然后我们就可以看到如下的界面 4.允许用户成对的点击符号配对 在textblock组件中MouseDown中添加如下函数 TextBlock lastTextBlockClicked;bool findingMatch false;//跟踪是否只点击了一个private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e){TextBlock textBlock sender as TextBlock;if (findingMatch false)//第一次选择{textBlock.Visibility Visibility.Hidden;lastTextBlockClicked textBlock;findingMatch true;}else if (textBlock.Text lastTextBlockClicked.Text){//第二次选择且相同matchesFound;textBlock.Visibility Visibility.Hidden;findingMatch false;}else{//第二次选择且不同lastTextBlockClicked.Visibility Visibility.Visible;findingMatch false;}}快速给所有xaml文件改MouseDown事件 将 / 替换为 MouseDown“TextBlock_MouseDown”/ 5. 增加一个计时器 首先在最上面的namespace下添加using System.Windows.Threading; 然后在添加如下代码 public partial class MainWindow : Window{DispatcherTimer timer new DispatcherTimer();int tenthsOfSecondsElapsed;//过去的时间int matchesFound;//找到的动物public MainWindow(){InitializeComponent();timer.Interval TimeSpan.FromSeconds(.1);timer.Tick Timer_Tick;SetUpGame();}private void Timer_Tick(object sender, EventArgs e){tenthsOfSecondsElapsed;timeTextBlock.Text (tenthsOfSecondsElapsed / 10F).ToString(0.0s);if(matchesFound8){timer.Stop();timeTextBlock.Text timeTextBlock.Text - end;}}在xaml下添加一个新的textBlock 添加后有17个textBlock,导致数组越界,所以我们要使用if (textBlock.Name ! “timeTextBlock”)判断 foreach (TextBlock textBlock in mainGrid.Children.OfTypeTextBlock()){if (textBlock.Name ! timeTextBlock){int index random.Next(animalEmoji.Count);string nextEmoji animalEmoji[index];textBlock.Text nextEmoji;animalEmoji.RemoveAt(index);}}最终结果如下 至此,我们就学习完了第一章,然后让我们复习一下本章讲了什么 学习了控制台的创建学习了WPF的创建,以及一个简易游戏的实现xaml文件的简单应用使用C#控制游戏逻辑的运行
http://www.dnsts.com.cn/news/4097.html

相关文章:

  • 济南高新区 网站建设公司广东建设网证件查询
  • 站长综合查询工具网站建设的描述
  • 网站上怎么做企业推广内蒙网站建设seo优化
  • 天津建设厅网站品牌设计logo图片
  • 网站建设部门宣言uniapp跳转内部页面
  • 深圳网站搭建多少钱佛山商城网站制作
  • php门户网站模板下载wordpress .net版本号
  • 怎么建立免费个人网站网络营销网站 功能
  • 给外国小孩 做 英语题用的网站百度小程序优化
  • 大型网站建设公司沈阳网络信息有限公司
  • 网站怎么做详情页nginx wordpress安全
  • 深圳市网站制作公司鸿蒙app开发工具
  • 免费网站制作软件网站js时间代码
  • 用别人服务器做网站国内10大搜索引擎
  • wordpress网站插件学电脑培训班多少一个月
  • 深圳网站建设定制开发超凡科技seo网络推广培训
  • 做公司网站可以抄别人的吗工业和信息化部电信设备认证中心
  • 网站备案 链接公司电商网站建设费用怎么记账
  • 好用的网站系统网站推广怎么做
  • 交通局网站模板现货行情分析软件app
  • 淘宝做动图网站泰安微信网站建设
  • 网站备案要多少天xsxz wordpress
  • php网站开发源码wordpress 子模板
  • 怎么做企业网站推广赚钱1网站免费建站
  • 优化网站关键词的技巧统一企业官网
  • 只做app不做网站可以吗网站建设需要参考哪些文献
  • 成都网站推广如何做书签网站
  • 网站参考页面设计电商网站规划的开发背景
  • 乐清网站制作公司企业网站优化应该怎么做
  • 溧阳网站设计jsp网页模板