public ExplorerBarPanelControlHost(ExplorerBarGroupItem parentPanel) { this.SetStyle(ControlStyles.UserPaint,true); this.SetStyle(ControlStyles.AllPaintingInWmPaint,true); this.SetStyle(ControlStyles.Opaque,true); this.SetStyle(ControlStyles.ResizeRedraw,true); this.SetStyle(ControlStyles.DoubleBuffer,true); this.TabStop=false; m_TopScrollButton=new ScrollButton(); m_TopScrollButton.UseTimer=false; m_TopScrollButton.StandardButton=true; m_TopScrollButton.Visible=false; m_TopScrollButton.Orientation=eOrientation.Vertical; m_TopScrollButton.ButtonAlignment=eItemAlignment.Near; m_TopScrollButton.Size=new Size(16,16); this.Controls.Add(m_TopScrollButton); m_BottomScrollButton=new ScrollButton(); m_BottomScrollButton.UseTimer=false; m_BottomScrollButton.StandardButton=true; m_BottomScrollButton.Visible=false; m_BottomScrollButton.Orientation=eOrientation.Vertical; m_BottomScrollButton.ButtonAlignment=eItemAlignment.Far; m_BottomScrollButton.Size=new Size(16,16); this.Controls.Add(m_BottomScrollButton); m_BottomScrollButton.MouseDown+=new MouseEventHandler(ScrollButtonClick); m_TopScrollButton.MouseDown+=new MouseEventHandler(ScrollButtonClick); m_ParentPanel=parentPanel; foreach(BaseItem item in m_ParentPanel.SubItems) item.ContainerControl=this; }
protected override void Dispose(bool disposing) { if(m_TopScrollButton!=null) { if(m_TopScrollButton.Parent!=null) m_TopScrollButton.Parent.Controls.Remove(m_TopScrollButton); m_TopScrollButton.Dispose(); m_TopScrollButton=null; } if(m_BottomScrollButton!=null) { if(m_BottomScrollButton.Parent!=null) m_BottomScrollButton.Parent.Controls.Remove(m_BottomScrollButton); m_BottomScrollButton.Dispose(); m_BottomScrollButton=null; } base.Dispose(disposing); }
private void SetupScrollButtons() { bool bDestroyTop=false,bDestroyBottom=false; if(!m_Scroll) { bDestroyTop=true; bDestroyBottom=true; } else { if(!m_TopScroll) bDestroyTop=true; if(!m_BottomScroll) bDestroyBottom=true; } if(bDestroyTop) { if(m_TopScrollButton!=null) { if(m_TopScrollButton.Parent!=null) m_TopScrollButton.Parent.Controls.Remove(m_TopScrollButton); m_TopScrollButton.Dispose(); m_TopScrollButton=null; } } else { if(m_TopScrollButton==null) { System.Windows.Forms.Control ctrl=this.ContainerControl as System.Windows.Forms.Control; if(ctrl!=null) { m_TopScrollButton=new ScrollButton(); m_TopScrollButton.Orientation=eOrientation.Vertical; m_TopScrollButton.ButtonAlignment=eItemAlignment.Near; ctrl.Controls.Add(m_TopScrollButton); m_TopScrollButton.Click+=new EventHandler(ScrollClick); } } if(m_TopScrollButton!=null) { m_TopScrollButton.Location=m_Rect.Location; m_TopScrollButton.Size=new Size(m_Rect.Width,10); m_TopScrollButton.BringToFront(); } } if(bDestroyBottom) { if(m_BottomScrollButton!=null) { if(m_BottomScrollButton.Parent!=null) m_BottomScrollButton.Parent.Controls.Remove(m_BottomScrollButton); m_BottomScrollButton.Dispose(); m_BottomScrollButton=null; } } else { if(m_BottomScrollButton==null) { System.Windows.Forms.Control ctrl=this.ContainerControl as System.Windows.Forms.Control; if(ctrl!=null) { m_BottomScrollButton=new ScrollButton(); m_BottomScrollButton.Orientation=eOrientation.Vertical; m_BottomScrollButton.ButtonAlignment=eItemAlignment.Far; ctrl.Controls.Add(m_BottomScrollButton); m_BottomScrollButton.Click+=new EventHandler(ScrollClick); } } if(m_BottomScrollButton!=null) { m_BottomScrollButton.Location=new Point(m_Rect.X,m_Rect.Bottom-10); m_BottomScrollButton.Size=new Size(m_Rect.Width,10); m_BottomScrollButton.BringToFront(); } } }
public SideBarPanelControlHost(SideBarPanelItem parentPanel) { this.SetStyle(ControlStyles.UserPaint,true); this.SetStyle(ControlStyles.AllPaintingInWmPaint,true); this.SetStyle(ControlStyles.Opaque,true); this.SetStyle(ControlStyles.ResizeRedraw,true); this.SetStyle(DisplayHelp.DoubleBufferFlag,true); this.TabStop=false; m_TopScrollButton=new ScrollButton(); m_TopScrollButton.UseTimer=false; m_TopScrollButton.StandardButton=true; m_TopScrollButton.Visible=false; m_TopScrollButton.Orientation=eOrientation.Vertical; m_TopScrollButton.ButtonAlignment=eItemAlignment.Near; ColorScheme scheme=null; if(parentPanel.Appearance==eSideBarAppearance.Flat) { m_TopScrollButton.Size=new Size(14,14); if(parentPanel.HeaderStyle!=null) { scheme=new ColorScheme(); scheme.ItemBackground=Color.Empty; scheme.ItemBackground=Color.Empty; scheme.ItemBackground=parentPanel.HeaderStyle.BackColor1.Color; scheme.ItemHotBackground=parentPanel.HeaderStyle.BackColor1.Color; scheme.ItemHotBackground2=parentPanel.HeaderStyle.BackColor2.Color; scheme.ItemHotBorder=parentPanel.HeaderStyle.BorderColor.Color; scheme.ItemPressedBorder=parentPanel.HeaderStyle.BorderColor.Color; scheme.ItemText=parentPanel.HeaderStyle.ForeColor.Color; scheme.ItemHotText=parentPanel.HeaderStyle.ForeColor.Color; scheme.ItemPressedText=parentPanel.HeaderStyle.ForeColor.Color; scheme.ItemPressedBackground=ControlPaint.Light(parentPanel.HeaderStyle.BackColor1.Color); scheme.ItemPressedBackground2=ControlPaint.Light(parentPanel.HeaderStyle.BackColor2.Color); m_TopScrollButton._Scheme=scheme; m_TopScrollButton.StandardButton=false; } } else m_TopScrollButton.Size=new Size(16,16); this.Controls.Add(m_TopScrollButton); m_BottomScrollButton=new ScrollButton(); m_BottomScrollButton.UseTimer=false; m_BottomScrollButton.StandardButton=true; m_BottomScrollButton.Visible=false; m_BottomScrollButton.Orientation=eOrientation.Vertical; m_BottomScrollButton.ButtonAlignment=eItemAlignment.Far; if(parentPanel.Appearance==eSideBarAppearance.Flat) { m_BottomScrollButton.Size=new Size(14,14); if(scheme!=null) { m_BottomScrollButton._Scheme=scheme; m_BottomScrollButton.StandardButton=false; } } else m_BottomScrollButton.Size=new Size(16,16); this.Controls.Add(m_BottomScrollButton); m_BottomScrollButton.MouseDown+=new MouseEventHandler(ScrollButtonClick); m_TopScrollButton.MouseDown+=new MouseEventHandler(ScrollButtonClick); m_ParentPanel=parentPanel; foreach(BaseItem item in m_ParentPanel.SubItems) item.ContainerControl=this; }