Пример #1
0
        void SetCustomPanePositionWhenFloating(ADXTaskPane.ADXCustomTaskPaneInstance customTaskPane, Screen screen)
        {
            if (screen == null)
            {
                screen = Screen.PrimaryScreen;
            }

            var area = screen.WorkingArea;

            SetCustomPanePositionWhenFloating(customTaskPane,
                                              area.Left + area.Width / 2 - customTaskPane.Width / 2,
                                              area.Top + area.Height / 2 - customTaskPane.Height / 2);
        }
Пример #2
0
        // http://stackoverflow.com/questions/6916402/c-excel-addin-cant-reposition-floating-custom-task-pane
        private void SetCustomPanePositionWhenFloating(ADXTaskPane.ADXCustomTaskPaneInstance customTaskPane, int x, int y)
        {
            // only do if pane is not docked
            if (customTaskPane.DockPosition == ADXCTPDockPosition.ctpDockPositionFloating)
            {
                customTaskPane.Visible = true;                                                 //The task pane must be visible to set its position

                var window = NativeMethods.FindWindowW("MsoCommandBar", customTaskPane.Title); //MLHIDE
                if (window != IntPtr.Zero)
                {
                    NativeMethods.MoveWindow(window, x, y, customTaskPane.Width, customTaskPane.Height, true);
                }
            }
        }
Пример #3
0
 public void SetCustomPanePositionWhenFloating(ADXTaskPane.ADXCustomTaskPaneInstance customTaskPane, object control)
 {
     //var screen = Screen.FromControl((Control)control);
     customTaskPane.Width  = customTaskPane.Parent.Width;
     customTaskPane.Height = customTaskPane.Parent.Height;
 }
Пример #4
0
 private void AddinModule_OnTaskPaneAfterCreate(object sender, ADXTaskPane.ADXCustomTaskPaneInstance instance, object control)
 {
     this.Logic.TaskPaneUpdater.SetCustomPanePositionWhenFloating(instance, control);
 }