• aaa


    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 WpfApplication1
    {
        /// <summary>
        /// MainWindow.xaml 的交互逻辑
        /// </summary>
        public partial class MainWindow : Window
        {
            System.Windows.Threading.DispatcherTimer timmer;
            const int WM_CLOSE = 0x00000111;
            [System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]
            static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
            [System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
            static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
    
            public MainWindow()
            {
                InitializeComponent();
            }
    
            private void msgShow_Click1(object sender, RoutedEventArgs e)
            {
                timmer = new System.Windows.Threading.DispatcherTimer();
                timmer.Tick += Timmer_Tick;
                timmer.Interval = new TimeSpan(0, 0, 3);
                timmer.Start();
    
                MessageBoxResult result = MessageBox.Show("hello", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                if (result == MessageBoxResult.OK)
                {
                    Console.WriteLine("OK");
                }
    
                ToolTip toolTip = grid.ToolTip as ToolTip;
                toolTip.Placement = System.Windows.Controls.Primitives.PlacementMode.MousePoint;
                toolTip.PlacementTarget = sender as Button;
                toolTip.Visibility = Visibility.Visible;
                toolTip.IsOpen = true;
                toolTip.Content = "zhang : 3 
    zhou : 5";
            }
    
            private void msgShow_Click2(object sender, RoutedEventArgs e)
            {
                timmer = new System.Windows.Threading.DispatcherTimer();
                timmer.Tick += Timmer_Tick;
                timmer.Interval = new TimeSpan(0, 0, 3);
                timmer.Start();
    
                MessageBoxResult result = MessageBox.Show("hello", "Information", MessageBoxButton.YesNo, MessageBoxImage.Information);
                if (result == MessageBoxResult.Yes)
                {
                    Console.WriteLine("Yes");
                }
                else
                {
                    Console.WriteLine("No");
                }
    
                ToolTip toolTip = grid.ToolTip as ToolTip;
                toolTip.Placement = System.Windows.Controls.Primitives.PlacementMode.MousePoint;
                toolTip.PlacementTarget = sender as Button;
                toolTip.Visibility = Visibility.Visible;
                toolTip.IsOpen = true;
                toolTip.Content = "zhang : 7 
    zhou : 8";
            }
    
            private void msgShow_Click3(object sender, RoutedEventArgs e)
            {
                timmer = new System.Windows.Threading.DispatcherTimer();
                timmer.Tick += Timmer_Tick;
                timmer.Interval = new TimeSpan(0, 0, 3);
                timmer.Start();
    
                MessageBoxResult result = MessageBox.Show("hello", "Information", MessageBoxButton.OKCancel, MessageBoxImage.Information);
                if (result == MessageBoxResult.OK)
                {
                    Console.WriteLine("ok");
                }
                else
                {
                    Console.WriteLine("Cancle");
                }
    
                ToolTip toolTip = grid.ToolTip as ToolTip;
                toolTip.Placement = System.Windows.Controls.Primitives.PlacementMode.MousePoint;
                toolTip.PlacementTarget = sender as Button;
                toolTip.Visibility = Visibility.Visible;
                toolTip.IsOpen = true;
                toolTip.Content = "zhang : 9 
    zhou : 10";
            }
    
            private void msgShow_Click4(object sender, RoutedEventArgs e)
            {
                timmer = new System.Windows.Threading.DispatcherTimer();
                timmer.Tick += Timmer_Tick;
                timmer.Interval = new TimeSpan(0, 0, 3);
                timmer.Start();
    
                MessageBoxResult result = MessageBox.Show("hello", "Information", MessageBoxButton.YesNoCancel, MessageBoxImage.Information);
                if (result == MessageBoxResult.Yes)
                {
                    Console.WriteLine("Yes");
                }
                else if (result == MessageBoxResult.Cancel)
                {
                    Console.WriteLine("No");
                }
                else
                {
                    Console.WriteLine("Cancle");
                }
    
                ToolTip toolTip = grid.ToolTip as ToolTip;
                toolTip.Placement = System.Windows.Controls.Primitives.PlacementMode.MousePoint;
                toolTip.PlacementTarget = sender as Button;
                toolTip.Visibility = Visibility.Visible;
                toolTip.IsOpen = true;
                toolTip.Content = "zhang : 11 
    zhou : 12";
            }
    
            private void Timmer_Tick(object sender, EventArgs e)
            {
                timmer.Stop();
    
                IntPtr mbWnd = FindWindow(null, "Information");
                if (mbWnd != IntPtr.Zero)
                {
                    SendMessage(mbWnd, WM_CLOSE, new IntPtr(7), IntPtr.Zero);
                }
            }
    
            private void msgShow_MouseLeave(object sender, MouseEventArgs e)
            {
                ToolTip toolTip = grid.ToolTip as ToolTip;
                toolTip.Visibility = Visibility.Hidden;
            }
        }
    }
    
  • 相关阅读:
    NB-IoT成为3GPP后会有哪些优势
    NB-IOT覆盖范围有多大 NB-IOT的强覆盖是怎么实现的
    4G DTU无线数据透明传输终端
    NB-IoT DTU是什么 NB-IoT的优势有哪些
    4G DTU是什么 4G DTU的功能和特点
    LoRa技术的发展应用和LoRa应用设备
    4G DTU为什么要具有透传的功能
    跨链在SIPC.VIP上的使用流程
    SimpleChain 开发挑战赛邀你来报名啦
    SimpleChain区块链管理系统使用教程
  • 原文地址:https://www.cnblogs.com/keyiei/p/6471658.html
Copyright © 2020-2023  润新知