コード例 #1
0
        /// <summary>
        /// Initialization and setup method
        /// </summary>
        /// <param name="name"></param>
        private void InitializeContainer(string name)
        {
            //Basic setup
            Name             = name;
            IsSplitterFixed  = true;
            SplitterDistance = 40;
            TabIndex         = 0;

            //Location and Margin
            Location = new Point(0, 0);
            Margin   = new Padding(2);
            Size     = new Size(780, 749);

            //Orientation and other settings
            Dock        = DockStyle.Fill;
            FixedPanel  = FixedPanel.Panel1;
            Orientation = Orientation.Horizontal;

            //Suspended Layout
            Panel1.SuspendLayout();
            Panel2.SuspendLayout();
            SuspendLayout();

            //Resume Layout
            Panel1.ResumeLayout(false);
            Panel2.ResumeLayout(false);
            Panel2.PerformLayout();
            ResumeLayout(false);
        }
コード例 #2
0
        /// <summary>
        /// Initialization and setup method
        /// </summary>
        /// <param name="name"></param>
        private void InitializeSplitContainer(string name)
        {
            Name = name;

            Dock       = DockStyle.Fill;
            FixedPanel = FixedPanel.Panel1;

            IsSplitterFixed = true;

            Location = new System.Drawing.Point(0, 0);
            Margin   = new Padding(6);

            Orientation = Orientation.Horizontal;

            Size             = new System.Drawing.Size(334, 411);
            SplitterDistance = 80;
            TabIndex         = 24;

            Panel1.SuspendLayout();
            Panel2.SuspendLayout();
            SuspendLayout();

            Panel1.ResumeLayout(false);
            Panel2.ResumeLayout(false);
            ResumeLayout(false);
        }
コード例 #3
0
        private void UpdateSplitter()
        {
            if (Orientation == Orientation.Vertical)
            {
                splitterDistance = MathHelper.Clamp(splitterDistance, panel1MinSize, Width - panel2MinSize - splitterWidth);
            }
            else if (Orientation == Orientation.Horizontal)
            {
                splitterDistance = MathHelper.Clamp(splitterDistance, panel1MinSize, Height - panel2MinSize - splitterWidth);
            }

            Panel1.SuspendLayout();
            Panel2.SuspendLayout();

            if (Panel1Collapsed == false && Panel2Collapsed == false)
            {
                if (Orientation == Orientation.Vertical)
                {
                    Panel1.Location = new Point();
                    Panel1.Size     = new Size(splitterDistance, Height);
                    Panel2.Location = new Point(splitterDistance + splitterWidth, 0);
                    Panel2.Size     = new Size(Width - splitterDistance - splitterWidth, Height);
                }
                else
                {
                    Panel1.Location = new Point();
                    Panel1.Size     = new Size(Width, splitterDistance);
                    Panel2.Location = new Point(0, splitterDistance + splitterWidth);
                    Panel2.Size     = new Size(Width, Height - splitterDistance - splitterWidth);
                }
            }
            else
            {
                if (Panel1Collapsed)
                {
                    Panel2.Location = new Point();
                    Panel2.Size     = Size;
                }
                else if (Panel2Collapsed)
                {
                    Panel1.Location = new Point();
                    Panel1.Size     = Size;
                }
            }

            Panel1.ResumeLayout();
            Panel2.ResumeLayout();
        }
コード例 #4
0
 private void AddGridsToForm()
 {
     this.SuspendLayout();
     Panel1.SuspendLayout();
     GridPanel.SuspendLayout();
     foreach (DataGridView grid in gridList)
     {
         GroupBox gridBox = new GroupBox();
         gridBox.Text = (string)grid.Tag;
         gridBox.Dock = DockStyle.Fill;
         gridBox.Controls.Add(grid);
         GridPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, GridHeight()));
         GridPanel.Controls.Add(gridBox);
     }
     this.ResumeLayout();
     Panel1.ResumeLayout();
     GridPanel.ResumeLayout();
 }
コード例 #5
0
    public void AddItem(string first, string second, string third)
    {
        adding = true;
        RichTextBox richText = new RichTextBox();

        innerSpliter.Panel2.SuspendLayout();
        Panel1.SuspendLayout();
        innerSpliter.Panel1.SuspendLayout();
        richText.Dock             = DockStyle.Top;
        richText.Width            = innerSpliter.Panel2.Width;
        richText.ContentsResized += ContentsResized;
        richText.BorderStyle      = BorderStyle.None;
        Label lbl = new Label()
        {
            Text = first, AutoSize = false, ForeColor = Color.BlueViolet
        };

        lbl.DataBindings.Add(GetHeightBinding(richText));
        lbl.DataBindings.Add(GetTopBinding(richText));
        lbl.DataBindings.Add(GetWidthBinding(Panel1));
        lbl.Parent = Panel1;
        lbl        = new Label()
        {
            Text = second, AutoSize = false, ForeColor = Color.BlueViolet
        };
        lbl.DataBindings.Add(GetHeightBinding(richText));
        lbl.DataBindings.Add(GetTopBinding(richText));
        lbl.DataBindings.Add(GetWidthBinding(innerSpliter.Panel1));
        lbl.Parent       = innerSpliter.Panel1;
        richText.Visible = false;
        richText.Parent  = innerSpliter.Panel2;
        richText.Visible = true;
        richText.Rtf     = third;
        richText.BringToFront();
        innerSpliter.Panel1.ResumeLayout(true);
        innerSpliter.Panel2.ResumeLayout(true);
        Panel1.ResumeLayout(true);
        innerSpliter.Panel2.ScrollControlIntoView(innerSpliter.Panel2.Controls[0]);
        adding = false;
    }
コード例 #6
0
        /// <summary>
        /// Initialize this has an IxCoreColleague
        /// </summary>
        public void Init(Mediator mediator, XmlNode configurationParameters)
        {
            CheckDisposed();

            this.SuspendLayout();
            Panel1.SuspendLayout();
            Panel2.SuspendLayout();
            this.IsInitializing = true;

            m_configurationParameters = configurationParameters;
            m_mediator = mediator;
            var toolNode = configurationParameters.SelectSingleNode("ancestor::tool");

            toolName = toolNode == null ? "" : toolNode.Attributes["value"].Value;
//			m_fDontCollapseFillPane = XmlUtils.GetOptionalBooleanAttributeValue(
//				m_configurationParameters, "dontCollapseFillPane", false);

            XmlNodeList nodes = configurationParameters.SelectNodes("control");

            if (nodes.Count != 2)
            {
                throw new ConfigurationException(
                          "Was expecting 2 controls to be defined in the parameters of the Multipane.",
                          configurationParameters);
            }

            string id = XmlUtils.GetAttributeValue(configurationParameters, "id", "");

            m_propertyControllingVisibilityOfFirstPane = GetPropertyControllingVisibilityOfFirstPane(nodes[0]);
            if (m_propertyControllingVisibilityOfFirstPane == null)
            {
                m_showingFirstPane = false;
            }
            else
            {
                m_showingFirstPane = true;                 // default
                // NOTE: we don't actually want to create and persist this property if it's not already loaded.
                object propertyValue;
                if (mediator.PropertyTable.PropertyExists(m_propertyControllingVisibilityOfFirstPane, out propertyValue, PropertyTable.SettingsGroup.LocalSettings))
                {
                    m_showingFirstPane = (bool)propertyValue;
                }
            }

            SplitterWidth = 5;
            if (id != "")             //must have an id if we're going to persist the value of the splitter
            {
                this.Name = id;       //for debugging
            }
            FirstLabel  = XmlUtils.GetOptionalAttributeValue(configurationParameters, "firstLabel", "");
            SecondLabel = XmlUtils.GetOptionalAttributeValue(configurationParameters, "secondLabel", "");
            SetFirstCollapseZone(nodes[0]);
            SetSecondCollapseZone(nodes[1]);

            string orientation = XmlUtils.GetOptionalAttributeValue(configurationParameters, "splitterBarOrientation", "vertical");

            if (orientation.ToLowerInvariant() == "horizontal" && Orientation != Orientation.Horizontal)
            {
                Orientation = Orientation.Horizontal;
            }
            else if (Orientation != Orientation.Vertical)
            {
                Orientation = Orientation.Vertical;
            }

            m_prioritySecond = XmlUtils.GetOptionalBooleanAttributeValue(configurationParameters,
                                                                         "prioritySecond", false);
            string defaultPrintPaneId = XmlUtils.GetOptionalAttributeValue(configurationParameters,
                                                                           "defaultPrintPane", "");
            string defaultFocusControl = XmlUtils.GetOptionalAttributeValue(configurationParameters,
                                                                            "defaultFocusControl", "");

            // If we are a subcontrol of a MultiPane, our DefaultPrintPane property may already be set.
            // we don't want to change it, unless it's not an empty string.
            if (!String.IsNullOrEmpty(defaultPrintPaneId))
            {
                m_defaultPrintPaneId = defaultPrintPaneId;
            }
            if (!String.IsNullOrEmpty(defaultFocusControl))
            {
                m_defaultFocusControl = defaultFocusControl;
            }
            MakeSubControl(nodes[0], Size, true);
            Panel1Collapsed = !m_showingFirstPane;
            MakeSubControl(nodes[1], Size, false);

            // Attempt to focus the default child control if there is one configured
            // TODO: Things are not yet in a suitable state, hooking onto a later event should work
            // TODO: But if you switch between tools in an area there is sometimes an extra
            // TODO: WM_LBUTTON_DOWN event which steals focus back into the ListViewItemArea
            SetFocusInDefaultControl();

            IsInitializing = false;
            Panel2.ResumeLayout(false);
            Panel1.ResumeLayout(false);
            ResumeLayout(false);

            //it's important to do this last, so that we don't go generating property change
            //notifications that we then go trying to cope with before we are ready
            mediator.AddColleague(this);
            m_fOkToPersistSplit = true;
        }
コード例 #7
0
        /// <summary>
        /// Initialize this has an IxCoreColleague
        /// </summary>
        public void Init(Mediator mediator, XmlNode configurationParameters)
        {
            CheckDisposed();

            this.SuspendLayout();
            Panel1.SuspendLayout();
            Panel2.SuspendLayout();
            this.IsInitializing = true;

            m_configurationParameters = configurationParameters;
            m_mediator = mediator;

//			m_fDontCollapseFillPane = XmlUtils.GetOptionalBooleanAttributeValue(
//				m_configurationParameters, "dontCollapseFillPane", false);

            XmlNodeList nodes = configurationParameters.SelectNodes("control");

            if (nodes.Count != 2)
            {
                throw new ConfigurationException(
                          "Was expecting 2 controls to be defined in the parameters of the Multipane.",
                          configurationParameters);
            }

            string id = XmlUtils.GetAttributeValue(configurationParameters, "id", "");

            m_propertyControllingVisibilityOfFirstPane = GetPropertyControllingVisibilityOfFirstPane(nodes[0]);
            if (m_propertyControllingVisibilityOfFirstPane == null)
            {
                m_showingFirstPane = false;
            }
            else
            {
                m_showingFirstPane = true;                 // default
                // NOTE: we don't actually want to create and persist this property if it's not already loaded.
                object propertyValue;
                if (mediator.PropertyTable.PropertyExists(m_propertyControllingVisibilityOfFirstPane, out propertyValue, PropertyTable.SettingsGroup.LocalSettings))
                {
                    m_showingFirstPane = (bool)propertyValue;
                }
            }

            SplitterWidth = 5;
            if (id != "")             //must have an id if we're going to persist the value of the splitter
            {
                this.Name = id;       //for debugging
            }
            FirstLabel  = XmlUtils.GetOptionalAttributeValue(configurationParameters, "firstLabel", "");
            SecondLabel = XmlUtils.GetOptionalAttributeValue(configurationParameters, "secondLabel", "");
            SetFirstCollapseZone(nodes[0]);
            SetSecondCollapseZone(nodes[1]);

            string orientation = XmlUtils.GetOptionalAttributeValue(configurationParameters, "splitterBarOrientation", "vertical");

            if (orientation.ToLowerInvariant() == "horizontal" && Orientation != Orientation.Horizontal)
            {
                Orientation = Orientation.Horizontal;
            }
            else if (Orientation != Orientation.Vertical)
            {
                Orientation = Orientation.Vertical;
            }

            m_prioritySecond = XmlUtils.GetOptionalBooleanAttributeValue(configurationParameters,
                                                                         "prioritySecond", false);
            string defaultPrintPaneId = XmlUtils.GetOptionalAttributeValue(configurationParameters,
                                                                           "defaultPrintPane", "");
            string defaultFocusControl = XmlUtils.GetOptionalAttributeValue(configurationParameters,
                                                                            "defaultFocusControl", "");

            // If we are a subcontrol of a MultiPane, our DefaultPrintPane property may already be set.
            // we don't want to change it, unless it's not an empty string.
            if (!String.IsNullOrEmpty(defaultPrintPaneId))
            {
                m_defaultPrintPaneId = defaultPrintPaneId;
            }
            if (!String.IsNullOrEmpty(defaultFocusControl))
            {
                m_defaultFocusControl = defaultFocusControl;
            }
            MakeSubControl(nodes[0], Size, true);
            Panel1Collapsed = !m_showingFirstPane;
            MakeSubControl(nodes[1], Size, false);

            //if (m_fDontCollapseFillPane)
            //{
            //    // As of this writing (6 Feb 2007) only two tools (Texts:Edit & Texts:Document)
            //    // used this m_fDontCollapseFillPane feature.
            //    // They had the same fixed size on that date, so no prior layout was needed to get the size.
            //    // We can, then, safely set the Panel2MinSize right now to that known size.
            //    // At some point in the future, some tool may use the 'dontCollapseFillPane'
            //    // to surpress shrinking to the icon,
            //    // which does not know its minimum size before a layout.
            //    // When that happens, we will need to revisit setting it here.
            //    if (Panel2MinSize < 100)
            //        Panel2MinSize = 100;
            //}

            // Need to focus proper child control.
            if (!TrySetFocusInControl(FirstControl, m_defaultFocusControl))
            {
                TrySetFocusInControl(SecondControl, m_defaultFocusControl);
            }

            //if (Parent != null)
            //{
            //    // Set default width of Panel1, since it wasn't done when the parent was set.
            //    // This happens when the XWindow is in charge of this MultiPane,
            //    // when loading either of the Text tools (as of 6 Feb 2007).
            //    SetSplitterDistance();
            //}

            this.IsInitializing = false;
            Panel2.ResumeLayout(false);
            Panel1.ResumeLayout(false);
            this.ResumeLayout(false);

            //it's important to do this last, so that we don't go generating property change
            //notifications that we then go trying to cope with before we are ready
            mediator.AddColleague(this);
            m_fOkToPersistSplit = true;
        }