当前位置: 首页 > 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

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • Spring通信传参的方法
  • AI人工智能大模型讲师叶梓《基于人工智能的内容生成(AIGC)理论与实践》培训提纲
  • OpenCV-Python(22):2D直方图
  • TensorFlow Hub模型
  • 拓展操作(三) jenkins迁移到另一个机器
  • 关键字:try-catch关键字
  • Ubuntu安装WordPress并使用Nginx作为Web服务器
  • Openwrt修改Dropbear ssh root密码
  • 数据流的中位数
  • 非常好用的ocr图片文字识别技术,识别图片中的文字
  • 【教学类-43-03】20231229 N宫格数独3.0(n=1、2、3、4、6、8、9) (ChatGPT AI对话大师生成 回溯算法)
  • 前端文件在虚拟机,后端在本机,两个如何通信
  • 2022年12月10日-2023年12月28日
  • Maven的使用和配置
  • 【java爬虫】使用element-plus进行个股详细数据分页展示
  • 【Under-the-hood-ReactJS-Part0】React源码解读
  • 【翻译】Mashape是如何管理15000个API和微服务的(三)
  • 4月23日世界读书日 网络营销论坛推荐《正在爆发的营销革命》
  • Android框架之Volley
  • bearychat的java client
  • CEF与代理
  • Git的一些常用操作
  • IOS评论框不贴底(ios12新bug)
  • Javascript编码规范
  • 给Prometheus造假数据的方法
  • 回流、重绘及其优化
  • 简析gRPC client 连接管理
  • 怎么将电脑中的声音录制成WAV格式
  • 栈实现走出迷宫(C++)
  • 容器镜像
  • #pragma预处理命令
  • (16)Reactor的测试——响应式Spring的道法术器
  • (9)YOLO-Pose:使用对象关键点相似性损失增强多人姿态估计的增强版YOLO
  • (el-Transfer)操作(不使用 ts):Element-plus 中 Select 组件动态设置 options 值需求的解决过程
  • (function(){})()的分步解析
  • (HAL)STM32F103C6T8——软件模拟I2C驱动0.96寸OLED屏幕
  • (PHP)设置修改 Apache 文件根目录 (Document Root)(转帖)
  • (动手学习深度学习)第13章 计算机视觉---微调
  • (附源码)流浪动物保护平台的设计与实现 毕业设计 161154
  • (汇总)os模块以及shutil模块对文件的操作
  • (力扣记录)1448. 统计二叉树中好节点的数目
  • (六)c52学习之旅-独立按键
  • (收藏)Git和Repo扫盲——如何取得Android源代码
  • (图文详解)小程序AppID申请以及在Hbuilderx中运行
  • (转)C#开发微信门户及应用(1)--开始使用微信接口
  • (转)nsfocus-绿盟科技笔试题目
  • ... 是什么 ?... 有什么用处?
  • .Family_物联网
  • .NET/C# 反射的的性能数据,以及高性能开发建议(反射获取 Attribute 和反射调用方法)
  • .NET/C#⾯试题汇总系列:集合、异常、泛型、LINQ、委托、EF!(完整版)
  • .net反混淆脱壳工具de4dot的使用
  • .NET框架
  • @ModelAttribute使用详解
  • @RequestMapping处理请求异常
  • [383] 赎金信 js