在用户控件中自动调整数据网格视图的大小

发布于 2024-09-13 13:54:26 字数 1441 浏览 5 评论 0原文

您好,我正在开发 Outlook 的自定义面板。 我有一个问题,如何自动调整 datagridview 到 userControl 的宽度和高度?

这是附加的内容: 替代文本 http://a.imageshack.us/img180/6938/custompanel.png< /a>

编辑:

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;
                }
            }
        }

并添加了一个TaskPaneControl(userControl)

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 http://a.imageshack.us/img180/6938/custompanel.png

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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薯片软お妹 2024-09-20 13:54:26

检查是否已将 Anchor 属性设置为所有四个方向,或将 Dock 属性设置为 DockStyle.Fill

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文