//public static Color SelectedSymbolColor = Color.Gray; #endregion #region Methods /// <summary> /// Place a <see c_ref="CurveItem" /> in the selection list, removing all other /// items. /// </summary> /// <param name="master">The <see c_ref="MasterPane" /> that is the "owner" /// of the <see c_ref="CurveItem" />'s.</param> /// <param name="ci">The <see c_ref="CurveItem" /> to be added to the list.</param> public void Select( MasterPane master, CurveItem ci ) { //Clear the selection, but don't send the event, //the event will be sent in "AddToSelection" by calling "UpdateSelection" ClearSelection( master, false ); AddToSelection( master, ci ); }
/// <summary> /// Clear the selection list and optionally trigger a <see c_ref="SelectionChangedEvent" />. /// </summary> /// <param name="master">The <see c_ref="MasterPane" /> that "owns" the selection list.</param> /// <param name="sendEvent">true to trigger a <see c_ref="SelectionChangedEvent" />, /// false otherwise.</param> public void ClearSelection( MasterPane master, bool sendEvent ) { Clear(); foreach ( GraphPane pane in master.PaneList ) { foreach ( CurveItem ci in pane.CurveList ) { ci.IsSelected = false; } } if ( sendEvent ) { if ( SelectionChangedEvent != null ) SelectionChangedEvent( this, new EventArgs() ); } }
/// <summary> /// Mark the <see c_ref="CurveItem" />'s that are included in the selection list /// by setting the <see c_ref="CurveItem.IsSelected" /> property to true. /// </summary> /// <param name="master">The <see c_ref="MasterPane" /> that "owns" the selection list.</param> public void UpdateSelection( MasterPane master ) { if ( Count <= 0 ) { ClearSelection( master ); return; } foreach ( GraphPane pane in master.PaneList ) { foreach ( CurveItem ci in pane.CurveList ) { //Make it Inactive ci.IsSelected = false; } } foreach ( CurveItem ci in this ) { //Make Active ci.IsSelected = true; //If it is a line / scatterplot, the selected Curve may be occluded by an unselected Curve //So, move it to the top of the ZOrder by removing it, and re-adding it. //Why only do this for Lines? ...Bar and Pie Curves are less likely to overlap, //and adding and removing Pie elements changes thier display order if ( ci.IsLine ) { //I don't know how to get a Pane, from a CurveItem, so I can only do it //if there is one and only one Pane, based on the assumption that the //Curve's Pane is MasterPane[0] //If there is only one Pane if ( master.PaneList.Count == 1 ) { GraphPane pane = master.PaneList[0]; pane.CurveList.Remove( ci ); pane.CurveList.Insert( 0, ci ); } } } //Send Selection Changed Event if ( SelectionChangedEvent != null ) SelectionChangedEvent( this, new EventArgs() ); }
/// <summary> /// Remove the specified <see c_ref="CurveItem" /> from the selection list. /// </summary> /// <param name="master">The <see c_ref="MasterPane" /> that is the "owner" /// of the <see c_ref="CurveItem" />'s.</param> /// <param name="ci">The <see c_ref="CurveItem" /> to be removed from the list.</param> public void RemoveFromSelection( MasterPane master, CurveItem ci ) { if ( Contains( ci ) ) Remove( ci ); UpdateSelection( master ); }
/// <summary> /// Clear the selection list and trigger a <see c_ref="SelectionChangedEvent" />. /// </summary> /// <param name="master">The <see c_ref="MasterPane" /> that "owns" the selection list.</param> public void ClearSelection( MasterPane master ) { ClearSelection( master, true ); }
/// <summary> /// Add a list of <see c_ref="CurveItem" />'s to the selection list. /// </summary> /// <param name="master">The <see c_ref="MasterPane" /> that is the "owner" /// of the <see c_ref="CurveItem" />'s.</param> /// <param name="ciList">The list of <see c_ref="CurveItem" />'s to be added to the list.</param> public void AddToSelection( MasterPane master, CurveList ciList ) { foreach ( CurveItem ci in ciList ) { if ( Contains( ci ) == false ) Add( ci ); } UpdateSelection( master ); }
/// <summary> /// Add a <see c_ref="CurveItem" /> to the selection list. /// </summary> /// <param name="master">The <see c_ref="MasterPane" /> that is the "owner" /// of the <see c_ref="CurveItem" />'s.</param> /// <param name="ci">The <see c_ref="CurveItem" /> to be added to the list.</param> public void AddToSelection( MasterPane master, CurveItem ci ) { if ( Contains( ci ) == false ) Add( ci ); UpdateSelection( master ); }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if the components should be /// disposed, false otherwise</param> protected override void Dispose( bool disposing ) { lock ( this ) { if ( disposing ) { if ( components != null ) components.Dispose(); } base.Dispose( disposing ); _masterPane = null; } }
/// <summary> /// Default Constructor /// </summary> public GraphControl() { InitializeComponent(); // These commands do nothing, but they get rid of the compiler warnings for // unused events bool b = MouseDown == null || MouseUp == null || MouseMove == null; // Link in these events from the base class, since we disable them from this class. base.MouseDown += ZedGraphControl_MouseDown; base.MouseUp += ZedGraphControl_MouseUp; base.MouseMove += ZedGraphControl_MouseMove; //this.MouseWheel += new System.Windows.Forms.MouseEventHandler( this.ZedGraphControl_MouseWheel ); // Use double-buffering for flicker-free updating: SetStyle( ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.ResizeRedraw, true ); //isTransparentBackground = false; //SetStyle( ControlStyles.Opaque, false ); SetStyle( ControlStyles.SupportsTransparentBackColor, true ); //this.BackColor = Color.Transparent; _resourceManager = new ResourceManager("UIGraphLib.GraphLocale", Assembly.GetExecutingAssembly() ); Rectangle rect = new Rectangle( 0, 0, Size.Width, Size.Height ); _masterPane = new MasterPane( "", rect ); _masterPane.Margin.All = 0; _masterPane.Title.IsVisible = false; string titleStr = _resourceManager.GetString( "title_def" ); string xStr = _resourceManager.GetString( "x_title_def" ); string yStr = _resourceManager.GetString( "y_title_def" ); //GraphPane graphPane = new GraphPane( rect, "Title", "X Axis", "Y Axis" ); GraphPane graphPane = new GraphPane( rect, titleStr, xStr, yStr ); using ( Graphics g = CreateGraphics() ) { graphPane.AxisChange( g ); //g.Dispose(); } _masterPane.Add( graphPane ); hScrollBar1.Minimum = 0; hScrollBar1.Maximum = 100; hScrollBar1.Value = 0; vScrollBar1.Minimum = 0; vScrollBar1.Maximum = 100; vScrollBar1.Value = 0; _xScrollRange = new ScrollRange( true ); _yScrollRangeList = new ScrollRangeList(); _y2ScrollRangeList = new ScrollRangeList(); _yScrollRangeList.Add( new ScrollRange( true ) ); _y2ScrollRangeList.Add( new ScrollRange( false ) ); _zoomState = null; _zoomStateStack = new ZoomStateStack(); }
/// <summary> /// The Copy Constructor - Make a deep-copy clone of this class instance. /// </summary> /// <param name="rhs">The <see c_ref="MasterPane"/> object from which to copy</param> public MasterPane( MasterPane rhs ) : base( rhs ) { // copy all the value types //_paneLayoutMgr = rhs._paneLayoutMgr.Clone(); _innerPaneGap = rhs._innerPaneGap; _isUniformLegendEntries = rhs._isUniformLegendEntries; _isCommonScaleFactor = rhs._isCommonScaleFactor; // Then, fill in all the reference types with deep copies _paneList = rhs._paneList.Clone(); _paneLayout = rhs._paneLayout; _countList = rhs._countList; _isColumnSpecified = rhs._isColumnSpecified; _prop = rhs._prop; _isAntiAlias = rhs._isAntiAlias; }