首页 > 解决方案 > Is there any way to change border/header background in VSTO outlook add in?

问题描述

I'm developing a VSTO plugin for Outlook 2016 but am not able to change the border and header background color (as you can see from the linked image).

I tried to force the "BackColor" property of the TaskPaneWpfControlHost object but what happens is that I get the background change of the user control injected into the container.

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

标签: c#wpfoutlookvsto

解决方案


您可以使用 BackColor 参考以下代码:

private const string WindowColor = @"#FF2D2D30";

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

欲了解更多信息,请参阅以下链接:

有什么方法可以更改 VSTO Outlook 插件中的自定义任务窗格颜色吗?

如何:设置 Windows 窗体面板的背景


推荐阅读