/// <summary> /// 获取控件y坐标 /// </summary> /// <returns></returns> private int GetTopPosition() { int iTopPosition = this.Padding.Top; int iNextTopPosition = 0; IEnumerator enumerator = this.Items.GetEnumerator(); while (enumerator.MoveNext()) { JMComboBoxButton xpanderPanel = (JMComboBoxButton)enumerator.Current; if (xpanderPanel.Visible == true) { if (iNextTopPosition == this.Padding.Top) { iTopPosition = this.Padding.Top; } else { iTopPosition = iNextTopPosition; } iNextTopPosition = iTopPosition + xpanderPanel.Height; } } return(iTopPosition); }
protected override Object CreateInstance(Type ItemType) { JMComboBoxButton xpanderPanel = (JMComboBoxButton)base.CreateInstance(ItemType); if (this.Context.Instance != null) { //xpanderPanel.Expand = true; } return(xpanderPanel); }
protected override void OnControlRemoved(System.Windows.Forms.ControlEventArgs e) { base.OnControlRemoved(e); JMComboBoxButton xpanderPanel = e.Control as JMComboBoxButton; if (xpanderPanel != null) { xpanderPanel.Click -= new EventHandler(xpanderPanel_Click); } }
int IList.Add(object value) { JMComboBoxButton xpanderPanel = value as JMComboBoxButton; if (xpanderPanel == null) { throw new ArgumentException(); } this.Add(xpanderPanel); return(this.IndexOf(xpanderPanel)); }
protected override void OnControlAdded(System.Windows.Forms.ControlEventArgs e) { base.OnControlAdded(e); JMComboBoxButton xpanderPanel = e.Control as JMComboBoxButton; if (xpanderPanel != null) { 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 - ScrollWidth - this.Padding.Left - this.Padding.Right; xpanderPanel.Top = this.GetTopPosition(); xpanderPanel.Click += new EventHandler(xpanderPanel_Click); } else { throw new InvalidOperationException("只能添加JMComboBoxButton对象"); } }
/// <summary> /// Removes the first occurrence of a specific XPanderPanel from the XPanderPanelCollection /// </summary> /// <param name="value">The XPanderPanel to remove from the XPanderPanelCollection</param> public void Remove(JMComboBoxButton xpanderPanel) { this.m_controlCollection.Remove(xpanderPanel); }
/// <summary> /// Adds a XPanderPanel to the collection. /// </summary> /// <param name="xpanderPanel">The XPanderPanel to add.</param> public void Add(JMComboBoxButton xpanderPanel) { this.m_controlCollection.Add(xpanderPanel); this.m_xpanderPanelList.Invalidate(); }
/// <summary> /// Determines whether the XPanderPanelCollection contains a specific XPanderPanel /// </summary> /// <param name="value">The XPanderPanel to locate in the XPanderPanelCollection</param> /// <returns>true if the XPanderPanelCollection contains the specified value; otherwise, false.</returns> public bool Contains(JMComboBoxButton xpanderPanel) { return(this.m_controlCollection.Contains(xpanderPanel)); }
/// <summary> /// Inserts an XPanderPanel to the collection at the specified index. /// </summary> /// <param name="index">The zero-based index at which value should be inserted. </param> /// <param name="xpanderPanel">The XPanderPanel to insert into the Collection.</param> public void Insert(int index, JMComboBoxButton xpanderPanel) { ((IList)this).Insert(index, (object)xpanderPanel); }
/// <summary> /// Returns the index of the specified XPanderPanel in the collection. /// </summary> /// <param name="xpanderPanel">The xpanderPanel to find the index of.</param> /// <returns>The index of the xpanderPanel, or -1 if the xpanderPanel is not in the <see ref="ControlCollection">ControlCollection</see> instance.</returns> public int IndexOf(JMComboBoxButton xpanderPanel) { return(this.m_controlCollection.IndexOf(xpanderPanel)); }