簡體   English   中英

VB.NET Windows 表單應用程序中的跳轉列表

[英]Jumplists in VB.NET Windows Form Application

有沒有辦法在 VB.NET Windows 表單應用程序中創建 Windows 任務欄跳轉列表? 我想將我上次打開的文件添加到列表中。

I've done a bunch of searching and can find this: https://docs.microsoft.com/en-us/dotnet/api/system.windows.shell.jumplist?redirectedfrom=MSDN&view=net-5.0 , but I can不知道如何在我的應用程序中訪問 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 中,則它在框架部分中。
  • 在對 JumpList 進行更改后調用 Apply() 非常重要。
  • 如果您是winforms,那么在您添加對PresentationFramework 的引用時,您會注意到GUI 的外觀發生了變化。 這似乎與 DPI 意識有關。 要修復,Go 到您的項目屬性 --> 應用程序 --> 查看 Windows 設置。 這應該會調出你的 app.manifest。 在那里,您會看到關於 dpiaware 的評論部分。 取消注釋整個部分。 嘗試將值設置為 true / false。 我發現 false 會使 GUI 看起來像以前一樣,而 true 在我的 GUI 中提高了 fonts 的清晰度。 任何一個值都應該解決這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM