2009-05-12 4 views
0

タスクバーにボタンの位置を設定する方法を教えてください - 理想的には、Sendボタンのすぐ隣に配置したいと思っています。VSTOのCommandBarButton位置

これまでのコードは次のとおりです。

Private Sub colInsp_NewInspector(ByVal Inspector As Microsoft.Office.Interop.Outlook.Inspector) Handles colInsp.NewInspector 
    Dim msg As Outlook.MailItem 
    Dim commandBar As Office.CommandBar 
    Dim encryptButton As Office.CommandBarButton 
    Dim olkitem As Object 
    olkitem = Me.ActiveInspector().CurrentItem 

    If TypeOf Inspector.CurrentItem Is Outlook.MailItem Then 
     msg = CType(Inspector.CurrentItem, Outlook.MailItem) 
     commandBar = Inspector.CommandBars("Standard") 
     encryptButton = commandBar.FindControl(Tag:="EncryptMail") 
     If Not (encryptButton Is Nothing) Then 
      encryptButton.Delete() 
     End If 
     encryptButton = CType(commandBar.Controls.Add(1), Office.CommandBarButton) 
     encryptButton.Style = Office.MsoButtonStyle.msoButtonIconAndCaption 
     encryptButton.FaceId = 718 
     encryptButton.Caption = "Secure Email" 
     encryptButton.Tag = "EncryptMail" 
     If olkitem.Sensitivity = Outlook.OlSensitivity.olConfidential Then 
      encryptButton.State = Office.MsoButtonState.msoButtonDown 
     End If 
     AddHandler encryptButton.Click, AddressOf encryptButton_Click 
     msg = Nothing 
    End If 
End Sub 

ご協力いただければ幸いです。

ありがとう、 Jim。

答えて

1

私はOutlook 2007で代わりに

-1

commandBar.AddControl(control, position)構文を使用している必要があります。

(Office.CommandBarButton)commandBars["Standard"].Controls.Add(Office.MsoControlType.msoControlButton, System.Reflection.Missing.Value, System.Reflection.Missing.Value,2,true); 

2は、位置の数です。

+0

ようこそ。あなたの投稿を編集して、コードを適切にフォーマットしてください(投稿エディタに統合されたヘルプがあります)。 – Xan