2015-10-18 26 views
0

想確認一些東西,因爲我使用的是Windows 10,而TaskDialog似乎沒有顯示任何可用的TaskDialogStandardIcon。有人可以確認是否在Windows 7相同的行爲?如果是的話如何解決這個問題在WIndows 10上?TaskDialog - 窗口上沒有圖標10

示例代碼:

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click 
    Dim dialog As New TaskDialog() 
    dialog.Caption = "Application Error" 
    dialog.InstructionText = "CRASH AND BURN!" 
    dialog.Text = "The application has performed an illegal action. Thisaction has been logged and reported." 
    dialog.Icon = TaskDialogStandardIcon.Error 
    dialog.Cancelable = False 
    dialog.DetailsExpanded = False 
    dialog.DetailsCollapsedLabel = "Show Expanded Text" 
    dialog.DetailsExpandedLabel = "Hide Expanded Text" 
    dialog.DetailsExpandedText = "### Start of Expanded Text ###" & Environment.NewLine & "" + Environment.NewLine + "### End of Expanded Text ###" 
    Dim minValue As Integer = 0 
    Dim maxValue As Integer = 100 
    Dim currentValue As Integer = 20 
    dialog.ProgressBar = New TaskDialogProgressBar(minValue, maxValue, currentValue) 
    dialog.Show() 
End Sub 

,我發現這個話題:Windows API Code Pack TaskDialog missing icon

你知不知道,這是否可以解決我的問題,以及如何做到這一點在vb.net?

回答

0

對不起話題,我發現的解決方案:

每TaskDialog其實我們要的事件處理程序的開業如下:

Public Sub taskDialog_Opened(sender As Object, e As EventArgs) 
     Dim taskDialog As TaskDialog = TryCast(sender, TaskDialog) 
     taskDialog.Icon = taskDialog.Icon 
     taskDialog.FooterIcon = taskDialog.FooterIcon 
     taskDialog.InstructionText = taskDialog.InstructionText 
    End Sub 

那麼它會去如下:

Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click 
     Dim mydialog As New TaskDialog 
     mydialog.Caption = "Application Error" 
     mydialog.InstructionText = "CRASH AND BURN!" 
     mydialog.Text = "The application has performed an illegal action. Thisaction has been logged and reported." 
     mydialog.Icon = TaskDialogStandardIcon.Error 


     AddHandler mydialog.Opened, AddressOf taskDialog_Opened '<======== 


     mydialog.Show() 


    End Sub