gpt4 book ai didi

c# - 任务栏图标闪烁效果

转载 作者:行者123 更新时间:2023-11-30 18:28:22 24 4
gpt4 key购买 nike

我正在尝试使用我的 C# 主窗体存档如图所示的闪烁效果。我用 Google 搜索了很多,发现可以使用 System.Windows.ShellTaskbarItemInfo。这似乎比下载和导入那些 dll 容易得多。

我知道如何创建一个新的 TaskbarItemInfo,但我不知道如何将它连接到主窗体。

关于如何使用 System.Windows.Shell 引用执行此操作的任何建议?

最佳答案

看不到图像..你是在说 Windows 7 的闪烁效果吗

创建一个新的 TaskbarItemInfo:

public TaskbarItemInfo TaskbarItemInfo { get;放;

    public Form1()
{
InitializeComponent();

this.TaskbarItemInfo = new TaskbarItemInfo();//
}

但我更喜欢这个:

使用 System.Runtime.InteropServices;

    [DllImport("user32.dll")]
public static extern int FlashWindow(IntPtr Hwnd, bool Revert);

// check if window is minimised

private void Form4_Resize(object sender, EventArgs e)

{

if (this.WindowState == FormWindowState.Minimized)

FlashWindow(this.Handle, false);

}

这应该有效..

还有//闪烁窗口直到它获得焦点FlashWindow.Flash(这个);

//闪烁窗口 5 次FlashWindow.Flash(this, 5);

//开始“不确定地”闪烁FlashWindow.Start(这个);

//停止“不确定”闪烁FlashWindow.Stop(这个);

关于c# - 任务栏图标闪烁效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25106430/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com