zoukankan      html  css  js  c++  java
  • Winform 窗体闪烁 & 任务栏提示

    准备:

     1 [DllImport("user32.dll")]
     2 static extern bool FlashWindowEx(ref FLASHWINFO pwfi);
     3 
     4 [DllImport("user32.dll")]
     5 static extern bool FlashWindow(IntPtr handle, bool invert);
     6 
     7 [StructLayout(LayoutKind.Sequential)]
     8 public struct FLASHWINFO
     9 {
    10     public UInt32 cbSize;
    11     public IntPtr hwnd;
    12     public UInt32 dwFlags;
    13     public UInt32 uCount;
    14     public UInt32 dwTimeOut;
    15 }
    16 
    17 public const UInt32 FLASHW_STOP = 0x00000000;
    18 public const UInt32 FLASHW_CAPTION = 0x00000001;
    19 public const UInt32 FLASHW_TRAY = 0x00000002;
    20 public const UInt32 FLASHW_ALL = 0x00000003;
    21 public const UInt32 FLASHW_TIMER = 0x00000004;
    22 public const UInt32 FLASHW_TIMERNOFG = 0x0000000C

    事件

     1 private void button1_Click(object sender, EventArgs e)
     2 {
     3   //闪烁
     4   FLASHWINFO fi = new FLASHWINFO();
     5 
     6   fi.cbSize = (uint)Marshal.SizeOf(fi);
     7   fi.hwnd = this.Handle;
     8   fi.dwFlags = FLASHW_TIMER | FLASHW_ALL;
     9   fi.uCount = 5;
    10   fi.dwTimeOut = 75;
    11 
    12   FlashWindowEx(ref fi);
    13 }
    14 
    15 private void button2_Click(object sender, EventArgs e)
    16 {
    17     //任务栏消息提示
    18     this.WindowState = FormWindowState.Minimized;
    19     FlashWindow(this.Handle, true);
    20 }
  • 相关阅读:
    Cheatsheet: 2010 05.25 ~ 05.31
    Cheatsheet: 2010 07.01 ~ 07.08
    Cheatsheet: 2010 07.22 ~ 07.31
    Cheatsheet: 2010 06.01 ~ 06.07
    Cheatsheet: 2010 05.11 ~ 05.17
    Cheatsheet: 2010 06.08 ~ 06.15
    Cheatsheet: 2010 06.16 ~ 06.22
    Cheatsheet: 2010 06.23 ~ 06.30
    2020.7.20第十五天
    2020.7.19第十四天
  • 原文地址:https://www.cnblogs.com/lztwj/p/5311743.html
Copyright © 2011-2022 走看看