Example #1
0
 /// <summary>
 /// Raises the ControlAdded event.
 /// </summary>
 /// <param name="e">A ControlEventArgs that contains the event data.</param>
 protected override void OnControlAdded(System.Windows.Forms.ControlEventArgs e)
 {
     base.OnControlAdded(e);
     BSE.Windows.Forms.XPanderPanel xpanderPanel = e.Control as BSE.Windows.Forms.XPanderPanel;
     if (xpanderPanel != null)
     {
         if (xpanderPanel.Expand == true)
         {
             foreach (XPanderPanel tmpXPanderPanel in this.XPanderPanels)
             {
                 if (tmpXPanderPanel != xpanderPanel)
                 {
                     tmpXPanderPanel.Expand = false;
                     tmpXPanderPanel.Height = xpanderPanel.CaptionHeight;
                 }
             }
         }
         xpanderPanel.Parent = this;
         xpanderPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                     | System.Windows.Forms.AnchorStyles.Right)));
         xpanderPanel.Left  = this.Padding.Left;
         xpanderPanel.Width = this.ClientRectangle.Width
                              - this.Padding.Left
                              - this.Padding.Right;
         xpanderPanel.PanelStyle    = this.PanelStyle;
         xpanderPanel.ShowBorder    = this.ShowBorder;
         xpanderPanel.ColorScheme   = this.ColorScheme;
         xpanderPanel.Top           = this.GetTopPosition();
         xpanderPanel.CaptionClick += new EventHandler <XPanderPanelClickEventArgs>(this.XPanderPanelCaptionClick);
     }
     else
     {
         throw new InvalidOperationException("Can only add BSE.Windows.Forms.XPanderPanel");
     }
 }
Example #2
0
        /// <summary>
        /// Raises the VisibleChanged event.
        /// </summary>
        /// <param name="e">An EventArgs that contains the event data.</param>
        protected override void OnVisibleChanged(EventArgs e)
        {
            base.OnVisibleChanged(e);

            if (this.DesignMode == true)
            {
                return;
            }
            if (this.Visible == false)
            {
                if (this.Expand == true)
                {
                    this.Expand = false;
                    foreach (Control control in this.Parent.Controls)
                    {
                        BSE.Windows.Forms.XPanderPanel xpanderPanel =
                            control as BSE.Windows.Forms.XPanderPanel;

                        if (xpanderPanel != null)
                        {
                            if (xpanderPanel.Visible == true)
                            {
                                xpanderPanel.Expand = true;
                                return;
                            }
                        }
                    }
                }
            }
#if DEBUG
            //System.Diagnostics.Trace.WriteLine("Visibility: " + this.Name + this.Visible);
#endif
            CalculatePanelHeights();
        }
Example #3
0
 private void XPanderPanelCloseClick(object sender, EventArgs e)
 {
     BSE.Windows.Forms.XPanderPanel xpanderPanel = sender as BSE.Windows.Forms.XPanderPanel;
     if (xpanderPanel != null)
     {
         this.Controls.Remove(xpanderPanel);
     }
 }
Example #4
0
 private void XPanderPanelExpandClick(object sender, EventArgs e)
 {
     BSE.Windows.Forms.XPanderPanel xpanderPanel = sender as BSE.Windows.Forms.XPanderPanel;
     if (xpanderPanel != null)
     {
         this.Expand(xpanderPanel);
     }
 }
Example #5
0
 private void btnAddXPanderPanel_Click(object sender, EventArgs e)
 {
     if (xPanderPanelList3 != null)
     {
         BSE.Windows.Forms.XPanderPanel xpanderPanel = new BSE.Windows.Forms.XPanderPanel();
         xpanderPanel.Text = "new XPanderPanel";
         xPanderPanelList3.XPanderPanels.Add(xpanderPanel);
     }
 }
Example #6
0
 private void XPanderPanelListControlRemoved(object sender, ControlEventArgs e)
 {
     BSE.Windows.Forms.XPanderPanelList xpanderPanelList = sender as BSE.Windows.Forms.XPanderPanelList;
     BSE.Windows.Forms.XPanderPanel     xpanderPanel     = e.Control as BSE.Windows.Forms.XPanderPanel;
     if ((xpanderPanel != null) && (xpanderPanelList != null))
     {
         MessageBox.Show(string.Format("'{0}' removed from '{1}'", xpanderPanel.Text, xpanderPanelList.Name));
     }
 }
Example #7
0
 private void xPanderPanelExpandClick(object sender, EventArgs e)
 {
     BSE.Windows.Forms.XPanderPanel xpanderPanel = sender as BSE.Windows.Forms.XPanderPanel;
     if (xpanderPanel != null)
     {
         propertyGrid1.Tag            = xpanderPanel;
         propertyGrid1.SelectedObject = xpanderPanel.CustomColors;
     }
 }
 private void btnAddXPanderPanel_Click(object sender, EventArgs e)
 {
     if (xPanderPanelList3 != null)
     {
         BSE.Windows.Forms.XPanderPanel xpanderPanel = new BSE.Windows.Forms.XPanderPanel();
         xpanderPanel.Text = "new XPanderPanel";
         xPanderPanelList3.XPanderPanels.Add(xpanderPanel);
     }
 }
Example #9
0
        private void CalculatePanelHeights()
        {
            if (this.Parent == null)
            {
                return;
            }

            int iPanelHeight = this.Parent.Padding.Top;

            foreach (Control control in this.Parent.Controls)
            {
                BSE.Windows.Forms.XPanderPanel xpanderPanel =
                    control as BSE.Windows.Forms.XPanderPanel;

                if ((xpanderPanel != null) && (xpanderPanel.Visible == true))
                {
                    iPanelHeight += xpanderPanel.CaptionHeight;
                }
            }

            iPanelHeight += this.Parent.Padding.Bottom;

            foreach (Control control in this.Parent.Controls)
            {
                BSE.Windows.Forms.XPanderPanel xpanderPanel =
                    control as BSE.Windows.Forms.XPanderPanel;

                if (xpanderPanel != null)
                {
                    if (xpanderPanel.Expand == true)
                    {
                        xpanderPanel.Height = this.Parent.Height
                                              + xpanderPanel.CaptionHeight
                                              - iPanelHeight;
                    }
                    else
                    {
                        xpanderPanel.Height = xpanderPanel.CaptionHeight;
                    }
                }
            }

            int iTop = this.Parent.Padding.Top;

            foreach (Control control in this.Parent.Controls)
            {
                BSE.Windows.Forms.XPanderPanel xpanderPanel =
                    control as BSE.Windows.Forms.XPanderPanel;

                if ((xpanderPanel != null) && (xpanderPanel.Visible == true))
                {
                    xpanderPanel.Top = iTop;
                    iTop            += xpanderPanel.Height;
                }
            }
        }
Example #10
0
        /// <summary>
        /// Raises the ControlRemoved event.
        /// </summary>
        /// <param name="e">A ControlEventArgs that contains the event data.</param>
        protected override void OnControlRemoved(System.Windows.Forms.ControlEventArgs e)
        {
            base.OnControlRemoved(e);

            BSE.Windows.Forms.XPanderPanel xpanderPanel =
                e.Control as BSE.Windows.Forms.XPanderPanel;

            if (xpanderPanel != null)
            {
                xpanderPanel.CaptionClick -= new EventHandler <XPanderPanelClickEventArgs>(this.XPanderPanelCaptionClick);
            }
        }
Example #11
0
        /// <summary>
        /// Raises the ControlRemoved event.
        /// </summary>
        /// <param name="e">A ControlEventArgs that contains the event data.</param>
        protected override void OnControlRemoved(System.Windows.Forms.ControlEventArgs e)
        {
            base.OnControlRemoved(e);

            BSE.Windows.Forms.XPanderPanel xpanderPanel =
                e.Control as BSE.Windows.Forms.XPanderPanel;

            if (xpanderPanel != null)
            {
                xpanderPanel.PanelStyleChanged -= new EventHandler <PanelStyleChangeEventArgs>(XpanderPanelPanelStyleChanged);
                xpanderPanel.ExpandClick       -= new EventHandler <EventArgs>(this.XPanderPanelExpandClick);
                xpanderPanel.CloseClick        -= new EventHandler <EventArgs>(this.XPanderPanelCloseClick);
            }
        }
Example #12
0
        /// <summary>
        /// Creates a new instance of the specified collection item type.
        /// </summary>
        /// <param name="ItemType">The type of item to create.</param>
        /// <returns> A new instance of the specified object.</returns>
        protected override Object CreateInstance(Type ItemType)
        {
            /* you can create the new instance yourself
             * ComplexItem ci=new ComplexItem(2,"ComplexItem",null);
             * we know for sure that the itemType it will always be ComplexItem
             * but this time let it to do the job...
             */

            BSE.Windows.Forms.XPanderPanel xpanderPanel =
                (BSE.Windows.Forms.XPanderPanel)base.CreateInstance(ItemType);

            if (this.Context.Instance != null)
            {
                xpanderPanel.Expand = true;
            }
            return(xpanderPanel);
        }
Example #13
0
        private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            PropertyGrid propertyGrid = s as PropertyGrid;

            if (propertyGrid != null)
            {
                BSE.Windows.Forms.XPanderPanel xpanderPanel = propertyGrid.Tag as BSE.Windows.Forms.XPanderPanel;
                if (xpanderPanel != null)
                {
                    PropertyDescriptor propertyDescriptor = TypeDescriptor.GetProperties(xpanderPanel.CustomColors)[e.ChangedItem.Label];
                    if (propertyDescriptor != null)
                    {
                        propertyDescriptor.SetValue(xpanderPanel.CustomColors, e.ChangedItem.Value);
                    }
                }
            }
        }
Example #14
0
        public Boolean ShowMenuItem1(string xParent,string xOpNo, string SubMenuCode, BSE.Windows.Forms.XPanderPanel mainpanel)
        {
            //可以显示菜单项返回TRUE,否则返回FALSE

            SqlDataReader xRtn = Program.SqlReader("select * from MenuView where Parent='" + xParent + "'and  LimitID= '" + xOpNo + "' and CanRun='1' order by code");
            if (xRtn == null)
            {
                return false;
                mainpanel.Expand = false;

            }
            //xRtn.Close();
            if (xRtn.HasRows == false)
            {
                xRtn.Close();
                xRtn.Dispose();
                return false;
            }
            //if (Controls.Contains(MenuPic))
            //{
            //    Controls.Remove(MenuPic);
            //    MenuPic.Dispose();
            //}
            //int xTop = 30;
            //MenuPic = new PictureBox();
            //MenuPic.Top = pictureBox2.Top;
            //MenuPic.Left = pictureBox2.Left;
            //MenuPic.Width = pictureBox2.Width;
            //MenuPic.Height = pictureBox2.Height;
            //MenuPic.BackColor = pictureBox2.BackColor;
            //MenuPic.BorderStyle = pictureBox2.BorderStyle;

            //Controls.Add(MenuPic);
            //pictureBox2.SendToBack();

            if (xParent == "000")
            {

                while (xRtn.Read())
                {
                    xppanel = new BSE.Windows.Forms.XPanderPanel();
                    xppanel.Text = xRtn["Nam"].ToString().Trim();
                    xppanel.Tag = xRtn["code"].ToString().Trim();
                    xppanel.ColorScheme = BSE.Windows.Forms.ColorScheme.Professional;  //BSE.Windows.Forms.ColorScheme.Custom;
                    xppanel.ColorCaptionGradientBegin = System.Drawing.SystemColors.ControlLightLight;  //System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(177)))), ((int)(((byte)(250)))));//System.Drawing.Color.Ivory;// System.Drawing.SystemColors.InactiveCaptionText;// System.Drawing.Color.Pink;
                    xppanel.ColorCaptionGradientEnd = System.Drawing.Color.CornflowerBlue;//System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(53)))), ((int)(((byte)(145)))));//System.Drawing.Color.Green;//.ForestGreen;//System.Drawing.Color.RoyalBlue; //System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
                    xppanel.ColorCaptionGradientMiddle = System.Drawing.Color.CornflowerBlue;//System.Drawing.Color.FromArgb(((int)(((byte)(82)))), ((int)(((byte)(127)))), ((int)(((byte)(208)))));//System.Drawing.Color.FromArgb(((int)(((byte)(82)))), ((int)(((byte)(127)))), ((int)(((byte)(208)))));//System.Drawing.Color.CornflowerBlue;// System.Drawing.Color.LightSalmon;

                   // xppanel.Image =Res.I444.ToBitmap();

                    xppanel.Click += new EventHandler(xppanel_Click);
                    xPanderPanelList1.Controls.Add(xppanel);

                    if (xppanel.Text.Trim() == "制卡")
                    {
                        xppanel.AutoScroll = true;
                    }
                    else
                    {
                        xppanel.AutoScroll = false;
                    }
                    xppanel.Refresh();
                }

            }
            else
            {
                xTop = 0;
                while (xRtn.Read())
                {
                    MenuButt = new Button();
                    MenuButt.Parent = mainpanel;
                    MenuButt.Left = mainpanel.Left+25;
                    MenuButt.Top = mainpanel .CaptionHeight+xTop  ;
                    MenuButt.Width = 105;
                    MenuButt.Height = 53;
                    MenuButt.Text = xRtn["Nam"].ToString().Trim();
                    MenuButt.ImageList = imageList1;
                    MenuButt.ImageIndex = int.Parse(xRtn ["picid"].ToString ());
                    MenuButt.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
                    MenuButt.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
                    MenuButt.Click += new EventHandler(MenuButt_Click);
                    mainpanel.Controls.Add(MenuButt);
                    xTop = MenuButt.Top+ 33;

                }

            }

            xRtn.Close();
            xRtn.Dispose();
            return true;
        }