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

WPF 新手指引弹窗

新手指引弹窗介绍

        我们在第一次使用某个软件时,通常会有一个“新手指引”教学引导。WPF实现“新手指引”非常方便,且非常有趣。接下来我们就开始制作一个简单的”新手指引”(代码简单易懂,便于移植),引用到我们的项目中又可添加一些光彩。

代码实现

新建“新手指引”窗体
<Window x:Class="BeginerGuideDemo.GuideWindow"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:BeginerGuideDemo"mc:Ignorable="d"    WindowStyle="None" AllowsTransparency="True" Background="{x:Null}" Title="新手指引" Height="900" Width="1440"  Loaded="Window_Loaded"><Window.Resources><ResourceDictionary><ResourceDictionary.MergedDictionaries><ResourceDictionary><!-- 无表头TabControl样式 --><Style x:Key="noTitleTabControlStyle" TargetType="{x:Type TabControl}"><Setter Property="ItemContainerStyle"><Setter.Value><Style TargetType="{x:Type TabItem}"><Setter Property="Visibility" Value="Collapsed" /></Style></Setter.Value></Setter><Setter Property="BorderThickness" Value="0"></Setter></Style></ResourceDictionary></ResourceDictionary.MergedDictionaries></ResourceDictionary></Window.Resources><Grid><Border x:Name="backBorder" Background="#000000" Opacity="0.5" CornerRadius="6" Margin="10"/><TabControl Name="tabControl" SelectionChanged="tabControl_SelectionChanged"  Style="{StaticResource noTitleTabControlStyle}" Background="Transparent" Margin="0"><TabItem><Border x:Name="bdWelcome" Width="400" Height="274"  CornerRadius="6" ><Grid><Grid.RowDefinitions><RowDefinition Height="80"/><RowDefinition Height="*"/><RowDefinition Height="80"/></Grid.RowDefinitions><Image Grid.RowSpan="3"  Source="pack://application:,,,/Images/bg_guide_L.png"/><TextBlock  Text="跳过指引"  HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,15,5" FontSize="12" Cursor="Hand"MouseLeftButtonDown="SkipGuide_MouseLeftButtonDown" /><TextBlock Grid.Row="1" FontSize="18" Text="欢迎使用宇宙教学系统" VerticalAlignment="Top" HorizontalAlignment="Center"/><RichTextBox  Grid.Row="1" HorizontalAlignment="Center"  VerticalAlignment="Center" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" BorderThickness="0"   Background="Transparent"><FlowDocument TextAlignment="Center" ><Paragraph ><Run   FontSize="16" Text="让我们一起探究新的世界吧~"></Run></Paragraph></FlowDocument></RichTextBox><Button Grid.Row="2" Width="128" Height="40"  Content="点击继续" VerticalAlignment="Center" HorizontalAlignment="Center"Click="btnNext_Click" /></Grid></Border></TabItem><TabItem><Border x:Name="bdChangeBook" Width="400" Height="215" Margin="332,46,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" CornerRadius="6" ><Grid><Grid.RowDefinitions><RowDefinition Height="80"/><RowDefinition Height="*"/><RowDefinition Height="80"/></Grid.RowDefinitions><Image Grid.RowSpan="3"  Source="pack://application:,,,/Images/bg_guide_L.png"/><TextBlock  Text="跳过指引"  HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,60,5" FontSize="12" Cursor="Hand" MouseLeftButtonDown="SkipGuide_MouseLeftButtonDown" /><RichTextBox  Grid.Row="1"  HorizontalAlignment="Center"  VerticalAlignment="Center" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" BorderThickness="0"   Background="Transparent"><FlowDocument TextAlignment="Center" ><Paragraph ><Run   FontSize="16" Text="点击"></Run><Run   FontSize="16" Text="更换教材"></Run><Run   FontSize="16" Text=",可切换学段学科"></Run></Paragraph></FlowDocument></RichTextBox><Button Grid.Row="2" Width="128" Height="40"  Content="退出" VerticalAlignment="Center" HorizontalAlignment="Center"Click="EndGuid_Click" /></Grid></Border></TabItem></TabControl></Grid>
</Window>
主窗体使用“新手指引”弹窗
        public MainWindow(){InitializeComponent();}private void Window_Loaded(object sender, RoutedEventArgs e){new GuideWindow(txtbStudy).ShowDialog();}

实例链接:https://download.csdn.net/download/lvxingzhe3/88683465

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

相关文章:

  • py注册登录界面
  • 基于电商场景的高并发RocketMQ实战-Consumer端队列负载均衡分配机制、并发消费以及消费进度提交
  • 【Java开发岗面试】八股文—数据库MySQLRedis
  • IntelliJ IDEA [设置] 隐藏 .idea 等 .XXX 文件夹
  • 每日一题——LeetCode961
  • 基于Unity Editor开发一个技能编辑器可能涉及到的内容
  • Ubuntu 22.04 安装ftp实现与windows文件互传
  • EasyPoi使用案例
  • 分布式系统架构设计之分布式数据存储的分类和组合策略
  • javaEE -18(11000字 JavaScript入门 - 3)
  • LangChain.js 实战系列:入门介绍
  • pyCharm 打印控制台中文乱码解决办法
  • 计算机基础--Linux详解
  • 基于OpenAI的Whisper构建的高效语音识别模型:faster-whisper
  • cfa一级考生复习经验分享系列(十六)
  • 数模学习day05-插值算法
  • hive中struct相关函数总结
  • macos下转换.dmg文件为 .iso .cdr文件的简单方法
  • ALSA学习(5)——设备中的alsa
  • uniapp中组件库的丰富NumberBox 步进器的用法
  • 【Matlab】基于遗传算法优化BP神经网络 (GA-BP)的数据时序预测
  • 计算机毕业设计 基于HTML5+CSS3的在线英语阅读分级平台的设计与实现 Java实战项目 附源码+文档+视频讲解
  • 云原生|kubernetes|kubernetes资源备份和集群迁移神器velero的部署和使用
  • 【26.4K⭐】ShareX:一款开源免费、功能强大且丰富的截屏录屏软件
  • 什么是ajax,为什么使用ajax?
  • AI面板识别 - 华为OD统一考试
  • Linux之磁盘分区,挂载
  • 2核2G3M服务器上传速度多少?以阿里云和腾讯云为例
  • Cisco模拟器-OSPF路由协议
  • SpEL 的使用