2013-03-26 60 views
1

我在vb.net中創建了一個任務對話框,並且圖標沒有出現。(一切正常)我正在使用Microsoft.WindowsAPICodePack.Dialogs。我的代碼如下:TaskDialogStandardIcon不在任務對話框

Dim commandLink_Send = New TaskDialogCommandLink("btnShowAlternatives", "View Alternative Times", "Select an available time") 
    Dim commandLink_Ignore = New TaskDialogCommandLink("buttonIgnore", "Go Back", "Go back to booking form") 
    **td.Icon = TaskDialogStandardIcon.Shield** 
    td.Caption = "Application Error" 
    td.InstructionText = "Booking Clash" 
    td.Text = "The application has found a clash in one more of the selected resources" 
    td.Cancelable = False 
    td.Controls.Add(commandLink_Send) 
    td.Controls.Add(commandLink_Ignore) 
    AddHandler commandLink_Send.Click, AddressOf eventHandlers.commandLink_send_click 
    AddHandler commandLink_Ignore.Click, AddressOf eventHandlers.commandLink_ignore_click 

難道我做錯了什麼

乾杯

回答

3

目前,這裏只有1解決方法這一點。 您需要從Opened事件調用中進行設置。 事情是這樣的:

AddHandler yourTD.opened, AddressOf yourTD_Opened 

而添加的地方是這樣的:

Private Shared Sub yourTD_Opened(ByVal sender As Object, ByVal e As System.EventArgs) 
    yourTD.icon = TaskDialogStandardIcon.Shield 
    'And if you prefer you could also 
    'yourTD.FooterIcon = TaskDialogStandardIcon.whichevericonyouwant 
End Sub 

歡呼。

+0

如果你來這裏尋找像我這樣的c#代碼: taskDialog.Opened + = delegate {taskDialog.Icon = TaskDialogStandardIcon.Error; }; – 2015-09-01 01:17:48