基本信息
源码名称:wpf模拟弹出窗口的代码
源码大小:0.22M
文件格式:.rar
开发语言:C#
更新时间:2021-02-10
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍

wpf模拟弹出窗口的代码,模拟加载时,弹出提示信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
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.Shapes;
using System.Windows.Threading;

namespace WpfApplication4
{
    /// <summary>
    /// Window2.xaml 的交互逻辑
    /// </summary>
    public partial class Window2 : Window
    {
        long _start;
        DispatcherTimer timer;
        DispatcherTimer _closetime;
        public Window2()
        {
            InitializeComponent();
            timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromMilliseconds(1);
            _start = Environment.TickCount;
            timer.Tick = timer_Tick;
            timer.IsEnabled = true;
            this.Left = SystemParameters.WorkArea.Width - this.Width;
            this.EndTop = SystemParameters.WorkArea.Height - this.Height;
            this.Top = SystemParameters.WorkArea.Height;
        }

        void _closetime_Tick(object sender, EventArgs e)
        {
            this.Close();
        }

        public double EndTop { get; set; }

        void timer_Tick(object sender, EventArgs e)
        {
            while (this.Top > EndTop)
            {
                this.Top -= 0.1;
            }
            _closetime = new DispatcherTimer();
            _closetime.Interval = TimeSpan.FromMilliseconds(10000);
            _closetime.Tick = _closetime_Tick;
            _closetime.IsEnabled = true;
        }

        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            timer.Start();
        }

    }
}