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

个人网站首页公司网站建设费用

个人网站首页,公司网站建设费用,网站建设论文任务书,网站开发流程宜春目录 一、TextBlock和TextBox 1. 在TextBlock中实时显示当前时间 二、ListView 1.ListView显示数据 三、ComboBox 1. ComboBox和CheckBox组合实现下拉框多选 四、Button 1. 设计Button按钮的边框为圆角#xff0c;并对指针悬停时的颜色进行设置 一、TextBlock和TextBox…目录 一、TextBlock和TextBox 1. 在TextBlock中实时显示当前时间 二、ListView 1.ListView显示数据 三、ComboBox 1. ComboBox和CheckBox组合实现下拉框多选 四、Button 1. 设计Button按钮的边框为圆角并对指针悬停时的颜色进行设置 一、TextBlock和TextBox 1. 在TextBlock中实时显示当前时间 可以通过绑定和定时器的方式来实现在TextBlock中显示当前实时时间。 Window x:ClassRealTime.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:RealTimemc:IgnorabledTitleMainWindow Height450 Width800GridTextBlock NametimeTextBlockHorizontalAlignmentCenterVerticalAlignmentCenterFontSize24Width300Height40//Grid /Windowcs using System.Text; 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; using System.Timers; using System.Windows.Threading;namespace RealTime {public partial class MainWindow : Window{private DispatcherTimer _timer;public MainWindow(){InitializeComponent();// 初始化定时器_timer new DispatcherTimer();_timer.Interval TimeSpan.FromSeconds(1); // 每秒更新时间_timer.Tick Timer_Tick; // 定时器的 Tick 事件_timer.Start(); // 启动定时器}private void Timer_Tick(object sender, EventArgs e){// 获取当前时间并更新 TextBoxtimeTextBlock.Text DateTime.Now.ToString(yyyy/MM/dd:HH:mm:ss);}} } 生成效果 说明1 DispatcherTimerWPF 提供了 DispatcherTimer 类它允许你在指定的时间间隔后执行代码并且能够在 UI 线程上安全地更新 UI 元素。DispatcherTimer 每次触发时会调用 Tick 事件。 Interval设置为每秒触发一次。 Tick 事件每秒钟触发一次在 Timer_Tick 方法中更新时间。这里使用了 DateTime.Now.ToString(HH:mm:ss) 格式来显示当前的小时、分钟和秒。 说明2 DateTime.Now.ToString(HH:mm:ss) 显示小时、分钟和秒。 DateTime.Now.ToString(yyyy-MM-dd HH:mm:ss) 显示完整的日期和时间。 二、ListView 1.ListView显示数据 Window x:ClassListView.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:ListViewmc:IgnorabledTitleMainWindow Height450 Width800GridStackPanelListView NameStudentListMouseDoubleClickStudentList_MouseDoubleClickMargin10ListView.ViewGridViewGridViewColumn Header姓名Width100DisplayMemberBinding{Binding Name}/GridViewColumnGridViewColumn Header年龄Width100DisplayMemberBinding{Binding Age}/GridViewColumn/GridView/ListView.View/ListViewStackPanel OrientationHorizontalButton NameMode1Margin10HorizontalAlignmentLeftContent方式一ClickMode1_Click/ButtonButton NameMode2Margin10HorizontalAlignmentLeftContent方式二ClickMode2_Click/Button/StackPanel/StackPanel/Grid /WindowCS using System.Collections.ObjectModel; using System.Text; 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 ListView {public class Student{public string? Name { get; set; }public string? Age { get; set; }}public partial class MainWindow : Window{public ObservableCollectionStudent Items { get; set; }public MainWindow(){InitializeComponent(); }private void Mode1_Click(object sender, RoutedEventArgs e){StudentList.ItemsSource null;StudentList.Items.Clear();// 初始化选项集合Items new ObservableCollectionStudent{new Student { Name 张三, Age 20},new Student { Name 李四, Age 21},new Student { Name 王五, Age 22},new Student { Name 赵六, Age 23}};// 将Items集合绑定到ListView的ItemsSourceStudentList.ItemsSource Items;}private void Mode2_Click(object sender, RoutedEventArgs e){StudentList.ItemsSource null;StudentList.Items.Clear();StudentList.Items.Add(new Student { Name 孙悟空, Age 10000 });StudentList.Items.Add(new Student { Name 悟能, Age 5000 });StudentList.Items.Add(new Student { Name 悟净, Age 3000 });StudentList.Items.Add(new Student { Name 唐僧, Age 30 });}private void StudentList_MouseDoubleClick(object sender, MouseButtonEventArgs e){if(StudentList.SelectedItem is Student student){MessageBox.Show(姓名 student.Name ,年龄: student.Age);}}} } 页面显示说明 初始页面 通过 ItemsSource 列表的形式将数据绑定到页面上点击方式一 通过Items.Add(new 自定义类 { 属性  , 属性  ....... })的方式绑定数据点击方式二 双击查看选择了那一条数据 三、ComboBox 1. ComboBox和CheckBox组合实现下拉框多选 说明实现ComboBox下拉框是CheckBox通过CheckBox的勾选情况判断选择了哪些项目 Window x:ClassComboBox.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:ComboBoxmc:IgnorabledTitleMainWindow Height450 Width800GridStackPanel!-- 定义多选ComboBox --ComboBox NamemultiSelectComboBoxWidth200Height30HorizontalAlignmentLeftIsEditableTrueStaysOpenOnEditTrueIsReadOnlyTrueText多选列表Margin10!-- 定义ComboBox的ItemTemplate包含一个CheckBox --ComboBox.ItemTemplateDataTemplateCheckBox Content{Binding Name}IsChecked{Binding IsSelected, ModeTwoWay} //DataTemplate/ComboBox.ItemTemplate/ComboBox!-- 按钮显示所选项目 --Button Content查看选择了什么选项Width170Height30VerticalAlignmentTopHorizontalAlignmentLeftMargin10ClickShowSelectedOptions_Click //StackPanel/Grid /WindowCS using System.Collections.ObjectModel; using System.Text; 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 ComboBox {public class Student{public string? Name { get; set; } public bool IsSelected { get; set; }}public partial class MainWindow : Window{public ObservableCollectionStudent Items { get; set; }public MainWindow(){InitializeComponent();// 初始化选项集合Items new ObservableCollectionStudent{new Student { Name 张三},new Student { Name 李四},new Student { Name 王五},new Student { Name 赵六}};// 将Items集合绑定到ComboBox的ItemsSourcemultiSelectComboBox.ItemsSource Items;}// 显示已选择的选项private void ShowSelectedOptions_Click(object sender, RoutedEventArgs e){ // 获取所有IsSelected为true的项目var selectedItems Items.Where(item item.IsSelected).Select(item item.Name).ToList();// 显示选择的项目multiSelectComboBox.Text 你选择了: string.Join(, , selectedItems);}} } 页面 点击下拉框选择两个项目 点击按钮 四、Button 1. 设计Button按钮的边框为圆角并对指针悬停时的颜色进行设置 Window x:ClassButton_Coner.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:Button_Conermc:IgnorabledTitleMainWindow Height450 Width800Window.Resources!-- 定义带有悬停效果的按钮样式 --Style TargetTypeButtonSetter PropertyTemplateSetter.ValueControlTemplate TargetTypeButtonBorder x:Nameborder Background{TemplateBinding Background} BorderBrush{TemplateBinding BorderBrush} BorderThickness{TemplateBinding BorderThickness}CornerRadius20ContentPresenter HorizontalAlignmentCenter VerticalAlignmentCenter//BorderControlTemplate.Triggers!-- 悬停时改变背景颜色 --Trigger PropertyIsMouseOver ValueTrueSetter TargetNameborder PropertyBackground ValueLightCoral//Trigger/ControlTemplate.Triggers/ControlTemplate/Setter.Value/Setter/Style/Window.ResourcesGridButton Width150 Height50 Content圆角按钮 BackgroundLightBlue/Button Width100 Height50 Content测试 BorderBrushGreen BorderThickness2 HorizontalAlignmentLeft/Button/Grid /Window样式
http://www.hkea.cn/news/14527858/

相关文章:

  • 成都网络推广网站营销型网站与展示型网站
  • 招聘网站怎么做seo摄影网站规划设计书
  • 烟台网站搭建wordpress自建表格
  • 建大网站首页商派商城网站建设
  • 手机怎么上wap网站ui设计通常是指
  • 做网站 钱重庆网站建设的好处
  • 电商网站开发流程文档配色设计网站推荐
  • 广西响应式网站哪家好龙城建设网站公司
  • 专业 网站设计公司价格南宁建站模板厂家
  • 手机网站页面模板wordpress域名设置方法
  • 站酷海洛全球云邮登陆网站
  • 做威士忌的网站平台app开发制作
  • 网站开发心得500字ui设计师为什么干不长久呢
  • 迅腾网络网站建设有限公司福建建设监理网站
  • 网站为什么功能需求进网站后台加什么
  • 怎么编写网站代码做网站如何能让外国人看得到
  • 网站开发的基本功能做官网设计好的公司
  • 网站建设一般多少钱一年制作网页如何添加图片
  • 深圳 网站 设计广告网站定制
  • 推广一个网站周期网站建设免费模板哪家好
  • 湛江市住房和城乡建设网站企业微信会话内容存档
  • 关于网站建设的意义seo排名优化培训班
  • 买个网站域名多少钱哪个网站做简历
  • 佛山网站建设佛山网站制作广告制作公司名称
  • 做网站推广微信叫什么网名好软文代写代发
  • 电子商务网站建设重点各大网站的域名是什么原因
  • 网站后台进不去的原因品牌官方网站
  • 广州优秀网站设计设计网页心得体会
  • 网站建设收费项目婚庆素材网站免费
  • 分栏型网站有哪些网站建设工作