VB.NET Windows窗体应用程序中的跳转列表



有办法在VB.NET Windows窗体应用程序中创建Windows任务栏跳转列表吗?我想将上次打开的文件添加到列表中。

我做了很多搜索,可以找到以下内容:https://learn.microsoft.com/en-us/dotnet/api/system.windows.shell.jumplist?redirectedfrom=MSDN&view=net-5.0,但我不知道如何在我的应用程序中访问System.Windows.Shell。它说找不到命名空间。

你能给我指任何方向都将不胜感激!

以下是我的工作:

Dim a As System.Windows.Application = System.Windows.Application.Current
If a Is Nothing Then a = New System.Windows.Application
Dim currJumpList As System.Windows.Shell.JumpList = JumpList.GetJumpList(a)
If currJumpList Is Nothing Then
currJumpList = New JumpList
JumpList.SetJumpList(a, currJumpList)
Else
currJumpList.JumpItems.Clear()
End If
Dim jumpTask As JumpTask
jumpTask = New JumpTask
jumpTask.Title = "This is what gets shown to the user"
jumpTask.Description = "This is what the user sees if they hover or the item"
jumpTask.ApplicationPath = "pathToYourEXE"
jumpTask.Arguments = "Your arguments"
jumpTask.CustomCategory = "The category header"
currJumpList.JumpItems.Add(jumpTask)
currJumpList.Apply()

重要提示:

  • 您需要添加对PresentationFramework.dll的引用。如果您在Visual Studio中,它在Framework部分中
  • 在对JumpList进行更改后调用Apply((非常重要
  • 如果你是winforms,当你为PresentationFrame添加引用时,你会注意到GUI的外观发生了变化。这似乎与新闻部的意识有关。若要修复此问题,请转到"项目属性"-->应用程序-->查看Windows设置。这应该会显示你的app.manifest。在那里,你会看到一个关于dpiaware的评论部分。取消对整个节的注释。玩将值设置为true/false的游戏。我发现false会让GUI看起来像以前一样,而true则提高了GUI中字体的清晰度。不过,任何一个值都应该解决这个问题

相关内容

最新更新