index > Visual Studio Tools for Office > Layout Of Dynamic Controls In Outlook 2007

Layout Of Dynamic Controls In Outlook 2007


i am populating an outlook 2007 form region with controls dynamically depending upon values in a database.

so for example i might want this layout:

Custom Field Name 1: [TEXTBOX]

Custom Field Name 2: [CHECKBOX]

at the moment i am using the Left properties but i am having a hard time lining things up to my satisfaction. is there a better way for me to line up these dynamic controls that i am missing?

thanks.

Wee Bubba

There are a couple of different approaches to the layout of controls on a form region. By default Outlook attempts to automatically adjust the layout of controls using automatic layout. However, controls added dynamically to the form can be difficult to have them lay out as you expect.

If you are adding these controls to a form region that already contains other controls that were added during design mode, you should use a Frame control on the form in design mode to reserve space for where these dynamic controls will be added. If there are no controls on the form in design mode, this should not be a concern.

When the BeforeFormRegionShow method fires, the form will be opened in the same dimenions that were used when it was last designed and saved. You should position your controls according to this design size, with the approriate spacing between controls. To adjust the position of the controls, you'll need to cast the control to the Forms.Control interface and set the Top, Left, Width, and Height properties. You can also adjust how Outlook controls the layout for the control by casting the control to the OlkControl interface and using the VerticalLayout and HorizontalLayout properties. For example, if you want Outlook to adjust the width of the control as the form resizes, you can set HorizontalLayout to olHorizontalLayoutGrow.

You can also take over the layout of the form completely if you want to ensure that everything is positioned exactly where you want them to be. You can disable layout for a particular control by setting the EnableAutoLayout property to False on the OlkControl interface, or you can turn it off for the whole form by setting FormRegion.EnableAutoLayout in the BeforeFormRegionShow event, and then setting the left and top properties accordingly. You can use the FormRegion.Form.Layout event to adjust the controls when the form is resized. This should only be used as a last resort though, you should try to use the automatic layout support unless you are unable to accomplish the design you want.

--Ryan

Ryan Gregg
reply 2

You can use google to search for other answers

 

More Articles

Save MailItem as MSG file
InnerObject property is not available any more
Access Developer Extensions IN VS2005
Preventing Document loading customization
CDOEX help needed
Set the cursor's position
2 ListObject into same sheet.
Preventing other applications to attach茅 to the running Word Inst...
MODI Languages
Smart tags in Outlook
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

Easy one
VSTO 2005 Outlook AddIn - SenderEmailAdd…
OutlookAddin
Refedit Control for VSTO
can we use the concept of cookies in vst…
Copying contacts
VSTO CTP June "V3": Excel - Us…
<the system cannot find the reference…
PLEASE READ FIRST: Non-VSTO Question/Iss…
How to select a task pane at startup?
General VSTO questions
New line without bullet
Interop.Word.dll
VSTO and Word menus doesn't merge
Order of selection events with Bookmark …

Hot Articles

Executing Exe file in to ASP.Net
Word Objects Within XmlNode
Server side Mail-Merge using VSTO2005
How to apply WordML.xslt to DataOnly.xml…
Get text from _WwG Class
Template Word & C#
Excel OLE Link Using VSTO
Invoke Word Document from C#
VSA deployment for .Net 2.0?
Need help with programming with outlook …
How to cast COMAddIn.Object in C#?
Can we customize Calendar View in Outlo…
VSTO 2005 Upgrade did not install Visual…
Bookmarks alternatives?
Installation VST 2005

Recommend Articles

Assembly on a server
Action Pane disappears
COM object with CLSID {...} is either no…
Filter in Word 2003
How to Set Default Form for Outlook Fold…
launching a VSTO app within a whidbey wi…
Request
Does the client needs .net framework 2?
How to make certain menu invalid or disa…
Delete
New button in navigation pane in Oulook …
Calculate Event and Changes in Range
Hide Table & Word 2003...
Reflection and Excel Toolbars
How to pass parameters to a Word VSTO so…