问题描述:
通过自定义选项卡的按钮新建一个面板(后续表述为方法二),面板上有DataGridView控件,如果调整DataGridView控件表头的高度,会出现无法显示这个控件的问题
对比直接新建一个面板,同时面板上有DataGridView控件,也调整该控件表头高度,可以正常显示 (后续表述为方法一);
同时还发现一个关联性问题: 如果方法一和方法二在同一个wordAddin程序中,方法一新建面板,调整了控件表头高度,那么方法二新建的面板,同时调整了表头高度的,也可以正常显示; 如果方法一新建面板,没调整控件表头高度,那吗方法二新建的面板,调整了表头高度的,则不能显示;
// UserControl1.Designer.cs or UserControl2.Designer.cs
// 调整表头高度代码 需要调整的加上这个,
// 同时将dataGridView.ColumnHeaderHeightSizeMode属性调整为非autoSize即可,不需要的删掉这行代码
this.dataGridView1.ColumnHeadersHeight = 100;
//新增面板代码 ThisAddIn.cs
// UserControl1 UserControl2 是新建的自定义用户控件
//UserControl1默认是直接新建pane
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
CreateUserControl();
}
public void CreateUserControl()
{
UserControl1 ucl = new UserControl1();
WordCustomPane.pane = Globals.ThisAddIn.CustomTaskPanes.Add(ucl, "Add-in1");
WordCustomPane.pane.Visible = true;
}
// Ribbon1.cs
//UserControl2是在自定义选项卡的按钮单击事件里新建pane
private void BTN_DisplayPane_Click(object sender, RibbonControlEventArgs e)
{
UserControl2 ucl = new UserControl2();
WordCustomPane.pane = Globals.ThisAddIn.CustomTaskPanes.Add(ucl, "Add-in2");
WordCustomPane.pane.Visible = true;
}
下面我做了两个插件用于对比,Add-in1 和Add-in2; Add-in1是可以正常显示的,Add-in2是不能正常显示的
暂时不能发图,账户没被验证,等晚上看看可以发的时候补充图片
竟然还不能验证账户信息,笑哭,图片,链接都发不了,笑哭笑哭~