gpt4 book ai didi

c# - 使用不同的屏幕自动调整 outlook 自定义任务 Pane 的大小

转载 作者:行者123 更新时间:2023-12-05 06:42:08 26 4
gpt4 key购买 nike

我创建了一个 outlook 插件并向其添加了一个自定义任务 Pane

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
taskpane = this.CustomTaskPanes.Add(new UCMaster(), "Summit Service Management");
UserControl ucmaster = taskpane.Control;
eh = new ElementHost { Child = new WPFUCMaster(new WPFUCLogin()) };
eh.Dock = DockStyle.Fill;
eh.AutoSize = true;
ucmaster.Controls.Add(eh);
taskpane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
taskpane.DockPositionRestrict = Office.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoChange;
taskpane.Width = 460;
taskPaneWidth = taskpane.Width;
taskPaneHeight = taskpane.Height;
ucmaster.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right);
ucmaster.AutoSizeMode = AutoSizeMode.GrowAndShrink;
ucmaster.AutoSize = true;
int h = ucmaster.Height;
int w = ucmaster.Width;
initialAddinInstance = this;
ucmaster.BringToFront();
}

这里我根据我的屏幕尺寸和分辨率对任务 Pane 宽度进行硬编码,它看起来很合适。

但是,在不同的屏幕上,我观察到任务 Pane 正在以任何其他方式被压缩。

我的问题是如何根据当前系统屏幕分辨率和尺寸动态更改任务 Pane 宽度?

最佳答案

对于容器控件,“AutoScaleMode”应该是 Inherit,对于叶控件,它应该是 Font。试试这个:ucmaster.AutoScaleMode = AutoScaleMode.Inherit;和让你的 child 用户控制:ucChild.AutoScaleMode = AutoScaleMode.Font;

关于c# - 使用不同的屏幕自动调整 outlook 自定义任务 Pane 的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38396437/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com