سؤال

وأنا أكتب VSTO الإضافية لإضافة زر شريط الأدوات قياسي لجميع MailItems جديدة في 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

وأي مساعدة سيكون موضع تقدير كبير!

وشكرا، جيم.

هل كانت مفيدة؟

المحلول

وأرجو أن يكون استخدام بناء الجملة commandBar.AddControl(control, position) بدلا

نصائح أخرى

وفي Outlook 2007:

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

وحيث 2 هو عدد المناصب.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top