Exemple #1
0
        void intermediatePanel_SizeChanged(object sender, EventArgs e)
        {
            if (sender != null)
            {
                if (sender is ThemedPanel)
                {
                    ThemedPanel themedPanel = sender as ThemedPanel;
                    if (themedPanel.Controls.Count > 0)
                    {
                        for (int x = 0; x < themedPanel.Controls.Count; x++)
                        {
                            if (themedPanel.Controls[x] is FieldContainerPanel)
                            {
                                int modifier       = ((ScrollbarsShowing(themedPanel, themedPanel.Controls[0]) & 2) == 2) ? 8 : 0;
                                int panelLocationX = (themedPanel.Width - themedPanel.Controls[x].Width) / 2;
                                panelLocationX -= modifier;                         // Adjust for the vertical scrollbar.
                                panelLocationX += themedPanel.AutoScrollPosition.X; // Adjust for the scroll amount... *should* always be zero.

                                if (themedPanel.Width > themedPanel.Controls[x].Width + modifier)
                                {
                                    themedPanel.Controls[x].Location = new Point(panelLocationX, themedPanel.Controls[x].Location.Y);
                                }
                                else
                                {
                                    themedPanel.Controls[x].Location = new Point(themedPanel.AutoScrollPosition.X, themedPanel.AutoScrollPosition.Y);
                                    //(themedPanel.Controls[x] as FieldContainerPanel).ForceAutoSize();
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
        int groupCount = 0; // global integer used by process group in the case that a block does not have a name or caption.
        #endregion

        /// <summary>
        /// Creates a new Tab page in the tab control.
        /// </summary>
        private void CreateTab(string caption)
        {
            TabItem item = tabControl.CreateTab(caption);

            tabControl.Margin = new Padding(0);

            isLoaded.Add(false);

            ThemedPanel intermediatePanel = new ThemedPanel();

            intermediatePanel.Dock       = DockStyle.Fill;
            intermediatePanel.AutoScroll = true;
            intermediatePanel.Margin     = new Padding(0);
            item.AttachedControl.Controls.Add(intermediatePanel);

            intermediatePanel.Scroll      += new ScrollEventHandler(intermediatePanel_Scroll);
            intermediatePanel.SizeChanged += new EventHandler(intermediatePanel_SizeChanged);

            FieldContainerPanel panel = new FieldContainerPanel();

            panel.AutoSize     = true;
            panel.AutoSizeMode = Prometheus.Controls.TagEditor.AutoSizeType.GrowAndShrink | Prometheus.Controls.TagEditor.AutoSizeType.WidthAndHeight;
            panel.Location     = new Point(0, 0);
            panel.Margin       = new Padding(0, 0, 0, 0);
            panel.Name         = "TagEditorTab";

            intermediatePanel.Controls.Add(panel);
            containers.Push(panel);
        }