4
public void flow_Resize(object sender, PaintEventArgs e)
           {
               FlowLayoutPanel flow = sender as FlowLayoutPanel;
               var item = listCtpMgr.FirstOrDefault(o => o.flp.Name == flow.Name);
               if (item == null)
                   return;
               addedCTP = (Microsoft.Office.Tools.CustomTaskPane)item.ctp;
               if (addedCTP == null)
                   return;
               ToolStrip _toolstrip = (ToolStrip)flow.Controls[0];
               int MaxButtonWidthforThisToolbar = 0;
               foreach (ToolStripItem toolStripItem in _toolstrip.Items)
               {
                   if ((toolStripItem.Width) > MaxButtonWidthforThisToolbar)
                   {
                       MaxButtonWidthforThisToolbar = (toolStripItem.Width);
                   }
               }
               MaxButtonWidthforThisToolbar += 10;
               if (addedCTP.DockPosition == MsoCTPDockPosition.msoCTPDockPositionLeft || addedCTP.DockPosition ==
   MsoCTPDockPosition.msoCTPDockPositionRight)
               {
                   if (addedCTP.Width < MaxButtonWidthforThisToolbar)
                       addedCTP.Width = MaxButtonWidthforThisToolbar;
               }
               else if (addedCTP.DockPosition == MsoCTPDockPosition.msoCTPDockPositionTop || addedCTP.DockPosition ==
   MsoCTPDockPosition.msoCTPDockPositionBottom)
               {
                   addedCTP.Height = 50;
               }
               else
               {
               addedCTP.Width = _toolstrip.Width + 27;
               addedCTP.Height = _toolstrip.Height + 57;
           }

       }

上面的自定义任务窗格代码在 Word 2010 中运行良好,但在 Word 2013 中它是 Flickring ..请帮助 ....我也使用了 Resize 和 SizeChange...

4

0 回答 0