public static void DeleteCTP() { if (ctp != null) { // Could hide instead, by calling ctp.Visible = false; ctp.Delete(); ctp = null; } }
public static void ShowCTP() { if (ctp == null) { // Make a new one using ExcelDna.Integration.CustomUI.CustomTaskPaneFactory ctp = CustomTaskPaneFactory.CreateCustomTaskPane(typeof(ContentControl), "My Super Task Pane"); ctp.Visible = true; ctp.DockPosition = MsoCTPDockPosition.msoCTPDockPositionLeft; ctp.DockPositionStateChange += ctp_DockPositionStateChange; ctp.VisibleStateChange += ctp_VisibleStateChange; } else { // Just show it again ctp.Visible = true; } }
static void Ctp_DockPositionStateChange(ExcelDna.Integration.CustomUI.CustomTaskPane CustomTaskPaneInst) { // This event can not trigger size change for task pane. }
static void Ctp_VisibleStateChange(ExcelDna.Integration.CustomUI.CustomTaskPane CustomTaskPaneInst) { XLRibbon._ribbonUi.InvalidateControl("ShtManager"); }
static void Ctp_DockPositionStateChange(ExcelDna.Integration.CustomUI.CustomTaskPane CustomTaskPaneInst) { //((ExportTablesMainView)ctp.ContentControl).label1.Text = "Moved to " + CustomTaskPaneInst.DockPosition.ToString(); // This event can not trigger size change for task pane. }
static void ctp_DockPositionStateChange(ExcelDna.Integration.CustomUI.CustomTaskPane CustomTaskPaneInst) { ((ContentControl)ctp.ContentControl).label1.Text = "Moved to " + CustomTaskPaneInst.DockPosition.ToString(); }
static void ctp_VisibleStateChange(ExcelDna.Integration.CustomUI.CustomTaskPane CustomTaskPaneInst) { MessageBox.Show("Visibility changed to " + CustomTaskPaneInst.Visible); }