有什么方法可以在VSTO Outlook插件中更改边框/标题背景吗?

时间:2018-11-13 16:13:58

标签: c# wpf outlook vsto

我正在为Outlook 2016开发VSTO插件,但无法更改边框和标题背景颜色(如从链接的图像中看到的那样)。

我尝试强制使用TaskPaneWpfControlHost对象的“ BackColor”属性,但是发生的是我得到了注入到容器中的用户控件的背景变化。

     public TaskPaneWpfControlHost(System.Windows.Controls.UserControl shell)
    {
        this.BackColor = System.Drawing.Color.White;
        InitializeComponent();
        wpfElementHost.HostContainer.Children.Add(shell);
        wpfElementHost.AutoSize = true;
        wpfElementHost.Dock = DockStyle.Fill;
        _shell = shell;
    }

1 个答案:

答案 0 :(得分:0)

您可以使用BackColor引用以下代码:

private const string WindowColor = @"#FF2D2D30";

var color = ColorTranslator.FromHtml(WindowColor);
this.BackColor = Color.FromArgb(color.R, color.G, color.B);

有关更多信息,请参考以下链接:

Is there any way to change custom task pane color in VSTO outlook add in?

How to: Set the Background of a Windows Forms Panel