VSTO 命令栏按钮位置
我正在编写一个 VSTO 加载项,为 Outlook 2003 中的所有新邮件项目添加一个按钮到标准工具栏。
我已经基本完成了,但我无法弄清楚如何设置按钮在任务栏上的位置- 理想情况下,我想将其放置在“发送”按钮旁边。
这是我到目前为止的代码。
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
任何帮助将不胜感激!
谢谢, 吉姆.
I'm writing a VSTO add-in to add a button the Standard toolbar for all new MailItems in Outlook 2003.
I've got it mostly finished, but I can't see to work out how to set the button's position on the taskbar - ideally I'd like to place it right next to the Send button.
Here's the code I have so far.
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
Any help would be tremendously appreciated!
Thanks,
Jim.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我应该使用
commandBar.AddControl(control,position)
语法I should have used the
commandBar.AddControl(control, position)
syntax instead