public FormRegionControls(Outlook.FormRegion region)
        {
            if (region != null)
            {
                try
                {
                    // Cache a reference to this region, this region's
                    // inspector, and the controls on this region.
                    _inspector  = region.Inspector;
                    _form       = region.Form as UserForm;
                    _ordersText = _form.Controls.Item(_ordersTextBoxName)
                                  as Microsoft.Vbe.Interop.Forms.TextBox;
                    _coffeeList = _form.Controls.Item(_formRegionListBoxName)
                                  as Outlook.OlkListBox;

                    // Fill the listbox with some arbitrary strings.
                    for (int i = 0; i < _listItems.Length; i++)
                    {
                        _coffeeList.AddItem(_listItems[i], i);
                    }
                    _coffeeList.Change += new
                                          Outlook.OlkListBoxEvents_ChangeEventHandler(
                        _coffeeList_Change);
                }
                catch (COMException ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.ToString());
                }
            }
        }
示例#2
0
        public FormRegionControls(Outlook.FormRegion region)
        {
            if (region != null)
            {
                try
                {
                    // 缓存对此区域及其
                    // 检查器以及此区域上的控件的引用。
                    _inspector  = region.Inspector;
                    _form       = region.Form as UserForm;
                    _ordersText = _form.Controls.Item(_ordersTextBoxName)
                                  as Microsoft.Vbe.Interop.Forms.TextBox;
                    _coffeeList = _form.Controls.Item(_formRegionListBoxName)
                                  as Outlook.OlkListBox;

                    // 使用任意字符串填充此列表框。
                    for (int i = 0; i < _listItems.Length; i++)
                    {
                        _coffeeList.AddItem(_listItems[i], i);
                    }
                    _coffeeList.Change += new
                                          Outlook.OlkListBoxEvents_ChangeEventHandler(
                        _coffeeList_Change);
                }
                catch (COMException ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.ToString());
                }
            }
        }
示例#3
0
        public void BeforeFormRegionShow(Outlook.FormRegion FormRegion)
        {
            // Create a new wrapper for the form region controls, hook up the Closed
            // event, and add it to our collection.
            FormRegionControls regionControls = new FormRegionControls(FormRegion);

            regionControls.Close += new EventHandler(regionControls_Close);
            openRegions.Add(regionControls);
        }
示例#4
0
 public void BeforeFormRegionShow(Outlook.FormRegion FormRegion)
 {
     if (FormRegion != null)
     {
         // 为窗体区域控件创建新的包装,
         // 并将其添加到我们的集合。
         Globals.ThisAddIn._uiElements.AttachFormRegion(
             FormRegion.Inspector, new FormRegionControls(FormRegion));
     }
 }
 public void BeforeFormRegionShow(Outlook.FormRegion FormRegion)
 {
     if (FormRegion != null)
     {
         // Create a new wrapper for the form region controls,
         // and add it to our collection.
         Globals.ThisAddIn._uiElements.AttachFormRegion(
             FormRegion.Inspector, new FormRegionControls(FormRegion));
     }
 }
示例#6
0
        public FormRegionControls(Outlook.FormRegion region)
        {
            // Fetch the controls from the form, to initialize our managed references.
            UserForm form         = region.Form as UserForm;
            Controls formControls = form.Controls;

            textBox1              = formControls.Item("TextBox1") as Outlook.OlkTextBox;
            commandButton1        = formControls.Item("CommandButton1") as Outlook.OlkCommandButton;
            commandButton1.Click += new Outlook.OlkCommandButtonEvents_ClickEventHandler(commandButton1_Click);
            region.Close         += new Outlook.FormRegionEvents_CloseEventHandler(region_Close);
        }