zoukankan      html  css  js  c++  java
  • 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;
            }
        }
    }
    
  • 相关阅读:
    从数据仓库系统对比看Hive发展前景
    Greenplum技术浅析
    MySQL索引背后的数据结构及算法原理zz
    超详细单机版搭建hadoop环境图文解析
    ActionScript 3.0 Step By Step系列(六):学对象事件模型,从点击按扭开始
    ActionScript 3.0 Step By Step系列(五):走在面向对象开发的路上,以类为基础去思考编程问题
    ActionScript 3.0 Step By Step系列(八):动态的数据展现源于灵活的数据绑定
    ActionScript 3.0 Step By Step系列(七):使用XML和XMLList类处理XML数据
    高质量的开源Flex UI组件库项目(FlexLib)
    什么是回调 CallBack
  • 原文地址:https://www.cnblogs.com/keyiei/p/6471658.html
Copyright © 2011-2022 走看看