Outlook 2007 Add-In : Reuse built-in 'To...' control at my Form Region (WinForm)
Is it possible to add 'To...' 'Outlook.OlkTextBox' OlkTextBox control at my WinForm (form region), so it will work like outlook build-i开发者_如何转开发n (I don't want to create my own copy of outlook address email input)?
If yes, could you somebody post a code sample?
Thanks!
P.S. Microsoft Office Outlook Text Box Control equals Outlook.OlkTextBox. I tried to use design mode (Visual Studio Tool Box with added COM component), but getting strange error while moving it at win form:
*Microsoft Visual Studio Failed to create component 'AxHost'. The error message follows: 'System.Runtime.InteropServices.COMException (0x80040154): Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) at System.Windows.Forms.Design.DocumentDesigner.AxToolboxItem.CreateComponentsCore(IDesignerHost host) at System.Drawing.Design.ToolboxItem.CreateComponentsCore(IDesignerHost host, IDictionary defaultValues) at System.Drawing.Design.ToolboxItem.CreateComponents(IDesignerHost host, IDictionary defaultValues) at System.Windows.Forms.Design.OleDragDropHandler.CreateTool(ToolboxItem tool, Control parent, Int32 x, Int32 y, Int32 width, Int32 height, Boolean hasLocation, Boolean hasSize, ToolboxSnapDragDropEventArgs e)'*
I guess that this is impossible, because 'To...' control is COM based and designed to work with COM form region (internal Outlook form region) (NOT WINFORM!)
Will work for Outlook INTERNAL Form Region only:
Microsoft.Office.Interop.Outlook.OlkTextBox dynamicTextBox = new Microsoft.Office.Interop.Outlook.OlkTextBox(); dynamic form = this.OutlookFormRegion.Form; form.Controls.Add("Outlook.OlkTextBox", dynamicTextBox, true); dynamicTextBox.Text = "Hello world!";
精彩评论