示例#1
0
        private XPPanel CreateXpPanel(XPPanelGroup XPPanelGroup, ImageSet xpImageSet, string caption, int image)
        {
            XPPanel xpPanel = new XPPanel();

            xpPanel.Name = "xpPanel";
            xpPanel.Anchor = (AnchorStyles)((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right);
            xpPanel.ForeColor = SystemColors.WindowText;
            xpPanel.BackColor = Color.Transparent;
            //xpPanel.Location = new Point(8, 8);
            xpPanel.Size = new Size(141, 100);
            xpPanel.TabIndex = 0;

            // Заголовок
            xpPanel.Caption = caption;
            xpPanel.Font = new Font("Courier New", 10F, FontStyle.Bold);
            //xpPanel.Font                            = new Font("Microsoft Sans Serif", 8F, FontStyle.Bold);
            xpPanel.TextColors.Foreground = Color.FromArgb(38, 115, 192);
            xpPanel.TextHighlightColors.Foreground = Color.FromArgb(38, 115, 192);
            xpPanel.VertAlignment = StringAlignment.Center;
            xpPanel.HorzAlignment = StringAlignment.Near;
            xpPanel.CaptionCornerType = XPPanelControl.CornerType.TopLeft | XPPanelControl.CornerType.TopRight;
            xpPanel.CurveRadius = 10;
            xpPanel.CaptionGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Horizontal;
            xpPanel.CaptionGradient.Start = Color.FromArgb(254, 254, 254);
            xpPanel.CaptionGradient.End = Color.FromArgb(231, 236, 242);
            xpPanel.CollapsedGlyphs.ImageSet = xpImageSet;
            xpPanel.CollapsedGlyphs.Normal = 3;
            xpPanel.CollapsedGlyphs.Pressed = 2;
            xpPanel.CollapsedGlyphs.Highlight = 2;
            xpPanel.ExpandedGlyphs.ImageSet = xpImageSet;
            xpPanel.ExpandedGlyphs.Normal = 1;
            xpPanel.ExpandedGlyphs.Pressed = 0;
            xpPanel.ExpandedGlyphs.Highlight = 0;

            // Бордюр и фон
            xpPanel.CaptionUnderline = Color.FromArgb(254, 254, 254);
            xpPanel.OutlineColor = Color.FromArgb(254, 254, 254);
            xpPanel.PanelGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Horizontal;
            xpPanel.PanelGradient.Start = Color.FromArgb(243, 245, 248);
            xpPanel.PanelGradient.End = Color.FromArgb(243, 245, 248);

            ButtonBar btnBar = new ButtonBar();

            // Фон
            btnBar.Dock = DockStyle.Fill;
            btnBar.ThemeProperty.ColorScheme = ColorScheme.Default;
            btnBar.ThemeProperty.UseTheme = false;
            btnBar.Appearance.Bar.BackStyle.BackColor1 = Color.FromArgb(243, 245, 248);
            btnBar.Appearance.Bar.BackStyle.BackColor2 = Color.FromArgb(243, 245, 248);
            btnBar.Appearance.Bar.AppearanceBorder.BorderVisibility = ToolStripStatusLabelBorderSides.None;
            btnBar.Appearance.Bar.CornerRadius = 0;

            // Отступы
            btnBar.Spacing = -1;
            btnBar.Padding = new Padding(10, 8, 10, 8);

            XPPanelGroup.Controls.Add(xpPanel);

            return xpPanel;
        }
示例#2
0
 public ControlPanelGroup(ControlPanel parent, string caption, int image)
 {
     Parent = parent;
     m_XPPanel = CreateXpPanel(parent.XPPanelGroup, parent.ImageSet, caption, image);
     m_ButtonBar = CreateButtonBar(m_XPPanel, ImageList ?? parent.ImageList);
     m_ButtonBar.ItemClick += new GenericClickEventHandler<BarItem>(ButtonBar_ItemClick);
 }
示例#3
0
        private ButtonBar CreateButtonBar(XPPanel xpPanel, ImageList imageList)
        {
            ButtonBar buttonBar = new ButtonBar();
            buttonBar.ImageList = imageList;
            buttonBar.ThemeProperty.UseTheme = false;
            buttonBar.HorizontalScroll.Visible = false;
            buttonBar.VerticalScroll.Visible = false;
            buttonBar.ShowBorders = true;
            // фон Bar'а
            buttonBar.Appearance.Bar.BackStyle.BackColor1 = Color.FromArgb(243, 245, 248);
            buttonBar.Appearance.Bar.BackStyle.BackColor2 = Color.FromArgb(243, 245, 248);
            // граница Bar'а
            buttonBar.Appearance.Bar.FocusedBorder = Color.FromArgb(243, 245, 248);
            buttonBar.Appearance.Bar.NormalBorder = Color.FromArgb(243, 245, 248);
            // фон Item'а
            buttonBar.Appearance.Item.BackStyle.BackColor1 = Color.FromArgb(243, 245, 248);
            buttonBar.Appearance.Item.BackStyle.BackColor2 = Color.FromArgb(243, 245, 248);
            buttonBar.Appearance.Item.HoverStyle.BackColor1 = Color.FromArgb(228, 238, 248);
            buttonBar.Appearance.Item.HoverStyle.BackColor2 = Color.FromArgb(228, 238, 248);
            buttonBar.Appearance.Item.ClickStyle.BackColor1 = Color.FromArgb(153, 204, 255);
            buttonBar.Appearance.Item.ClickStyle.BackColor2 = Color.FromArgb(153, 204, 255);
            buttonBar.Appearance.Item.SelectedStyle.BackColor1 = Color.FromArgb(192, 221, 252);
            buttonBar.Appearance.Item.SelectedStyle.BackColor2 = Color.FromArgb(192, 221, 252);
            buttonBar.Appearance.Item.SelectedHoverStyle.BackColor1 = Color.FromArgb(153, 204, 255);
            buttonBar.Appearance.Item.SelectedHoverStyle.BackColor2 = Color.FromArgb(153, 204, 255);
            // граница Item'а
            buttonBar.Appearance.Item.NormalBorder = Color.FromArgb(243, 245, 248);
            buttonBar.Appearance.Item.HoverBorder = Color.FromArgb(51, 153, 255);
            buttonBar.Appearance.Item.SelectedBorder = Color.FromArgb(51, 153, 255);

            buttonBar.Appearance.Item.AppearenceText.Font = new Font("Courier New", 9F, FontStyle.Regular);
            buttonBar.Appearance.Item.AppearenceText.Alignment = StringAlignment.Near;
            buttonBar.ImageAlignment = ImageAlignment.Left;

            buttonBar.Padding = new Padding(10, 8, 10, 8);
            buttonBar.Spacing = 0;

            xpPanel.Controls.Add(buttonBar);
            buttonBar.Location = new Point(1, 31);
            //buttonBar.Width  = 174;
            buttonBar.Height = 30;
            xpPanel.Height = 20 + 28;

            return buttonBar;
        }
示例#4
0
 /// <summary>
 /// Handle the <see cref="XPPanel.PropertyChange"/> event 
 /// </summary>
 /// <param name="xpPanel">The <see cref="XPPanel"/> whose property changed</param>
 /// <param name="e">instance of <see cref="XPPanelPropertyChangeEventArgs"/> describing the property change</param>
 /// <remarks>
 /// Currently we handle the <see cref="XPPanelProperties.PanelHeightProperty"/> so that we can
 /// ensure that the entire panel is visible. The <see cref="XPPanelProperties.PanelHeightProperty"/>
 /// is only changed when a <see cref="XPPanel"/> resizes due to a change in the size of child 
 /// controls. Typically this indicates some interest/focus on the users part, but you may want to
 /// supress this event if these changes are 'randomesque' in your application
 /// </remarks>
 private void XPPanelGroup_PropertyChange(XPPanel xpPanel, XPPanelPropertyChangeEventArgs e)
 {
     if (e.XPPanelProperty == XPPanelProperties.PanelHeightProperty) {
         EnsureVisible(xpPanel) ;
     }
 }
示例#5
0
        /// <summary>
        /// Update the location of all the <see cref="XPPanel"/> controls
        /// in the <see cref="XPPanelGroup"/> after a particular index
        /// </summary>
        /// <remarks>
        /// Used when a panel is collapsed or expanded to change all the
        /// subsequent panels
        /// </remarks>
        private void UpdatePanelsAfter(XPPanel panel)
        {
            // @@BUGFIX: 1.1
            if (!panel.Visible) {
                UpdatePanels() ;
                return ;
            }

            if (isInitializingComponent || updatingPanels)
                return ;

            updatingPanels = true ;

            // the bottom of the specified panel plus the BorderMargin.Height (which we always need
            // to take into account)
            int lastBottom = panel.Top + panel.Height ;

            // map the panel to its index in our panels collection
            int panelIndex = panels.IndexOf(panel) + 1 ;

            // for each following panel, relocate it
            for(int i=panelIndex ; i < panels.Count ; i++) {
                XPPanel nextPanel = (XPPanel) panels[i] ;

                // @@BUGFIX: 1.1
                if (!nextPanel.Visible)
                    continue ;

                UpdatePanel(nextPanel,lastBottom) ;
                lastBottom = nextPanel.Top + nextPanel.Height ;
            }

            updatingPanels = false ;
        }
示例#6
0
        /// <summary>
        /// Update an individual <see cref="XPPanel"/>
        /// </summary>
        /// <param name="panel">The panel to be updated</param>
        /// <param name="lastBottom">Bottom position of last <see cref="XPPanel"/> or 0 if this is the 1st panel
        /// in the <c>XPPanelGroup</c></param>
        private void UpdatePanel(XPPanel panel, int lastBottom)
        {
            if (panel.Left != BorderMargin.Width)
                panel.Left = BorderMargin.Width ;

            if (lastBottom != 0) {
                if (panel.Top != lastBottom + PanelSpacing)
                    panel.Top = lastBottom + PanelSpacing ;
            } else {
                if (panel.Top != lastBottom + BorderMargin.Height)
                    panel.Top = lastBottom + BorderMargin.Height ;
            }

            if (panel.Width != this.Width - (BorderMargin.Width << 1) - (VScroll ? SystemInformation.VerticalScrollBarWidth : 0))
                panel.Width = this.Width - (BorderMargin.Width << 1) - (VScroll ? SystemInformation.VerticalScrollBarWidth : 0) ;
        }
示例#7
0
        /// <summary>
        /// Change the order/position of the specified <see cref="XPPanel"/> 
        /// </summary>
        /// <param name="newIndex">The new index/position</param>
        /// <param name="xpPanel">The <see cref="XPPanel"/> to move</param>
        public void MovePanel(int newIndex,XPPanel xpPanel)
        {
            int indexOf = panels.IndexOf(xpPanel) ;

            if ((indexOf != -1) && (indexOf != newIndex)) {
                panels.RemoveAt(indexOf) ;
                panels.Insert(newIndex,xpPanel) ;
                UpdatePanels() ;
            }
        }
示例#8
0
        /// <summary>
        /// Ensure that the specified panel is fully visible (if possible) within 
        /// the <c>XPPanelGroup</c>
        /// </summary>
        /// <param name="xpPanel">The <see cref="XPPanel"/> to make visible</param>
        /// <remarks>
        /// If the panel is not visible it is made visible. If the bottom of the panel
        /// not visible, the group is scrolled to make it visible, otherwise if the
        /// top of the panel is not visible the scroll is adjusted to make it visible
        /// </remarks>
        /// <exception cref="ArgumentException">If the specified <see cref="XPPanel"/> is not
        /// a member of the <c>XPPanelGroup</c></exception>
        public void EnsureVisible(XPPanel xpPanel)
        {
            if (!panels.Contains(xpPanel)) {
                throw new ArgumentException("The specified XPPanel is not a member of this XPPanelGroup","XPPanel") ;
            }

            if (!xpPanel.Visible)
                xpPanel.Visible = true ;

            if (xpPanel.Bottom > (Height + AutoScrollPosition.Y)) {
                AutoScrollPosition = new Point(AutoScrollPosition.X,xpPanel.Bottom - Height) ;
            } else if (xpPanel.Top < 0) {
                AutoScrollPosition = new Point(AutoScrollPosition.X,Math.Max(0,xpPanel.Top-1)) ;
            }
        }