views:

18

answers:

1

Hi i am developing a custom panel for outlook. and i have a question, how can i autosize width and height the datagridview to the userControl?

This is what append: alt text

Edit:

Microsoft.Office.Tools.CustomTaskPane taskPane;
        Microsoft.Office.Interop.Outlook.Application applicationObject;
        Outlook.Explorer explorer;
        TaskPaneControl tpc;
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            explorer = this.Application.ActiveExplorer();
            explorer.SelectionChange+=new Microsoft.Office.Interop.Outlook.ExplorerEvents_10_SelectionChangeEventHandler(explorer_SelectionChange);
        }

        void explorer_SelectionChange()
        {
            if (taskPane == null)
            {
                tpc=new TaskPaneControl();
                taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(tpc, "Sender Details", explorer);
                taskPane.Visible = true;
                taskPane.Width = 245;
                return;
            }

            if (taskPane != null)
            {
                taskPane.Visible = true;
                taskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionBottom;
                taskPane.Height = 245;
                }
            }
        }

And added a TaskPaneControl (userControl)

+1  A: 

Check that you have set the Anchor property to all four directions, or the Dock property to DockStyle.Fill.

kbrimington
Just found it. Tks
Luis
its possible to fit it with (MaxWidth-30) ??
Luis
I would think so. I don't do much with Outlook add-ins, but in standard WinForms, I would accomplish that either by placing and sizing the control within its parent and ensuring that anchoring is set, or by listening to the parent control's resize events. If you can get the parent control's height and width, then I recommend anchoring, as layout will then be handled for you.
kbrimington