User (Legacy) Posted April 28, 2006 Report Share Posted April 28, 2006 Hi, When a user clicks the Hide / Show Legend button on my Chart FX chart, the X-Axis scroll bar scrolls to the left, so the user looses the data that they were looking at. The same thing used to happen whenever the chart size changed due to window resizing, but I fixed this by capturing the "Client Size Changed" event of the Split Container's Panel that my chart resides on, and setting the Scroll Bar position to what it used to be. I am trying to figure out how to capture a LegendBox Visible Changed event or other event that will allow me to set the Chart's Scroll position to what it was before the LegendBox was shown / hidden. I tried capturing the LegendBox's Visible Changed event like this: Chart.LegendBox.VisibleChanged += new EventHandler(LegendBox_VisibleChanged); but when the user clicks the Legend Show / Hide button the event handler is never called. How can I stop the X-Axis Scroll Bar Position from changing whenever the user shows or hides the LegendBox? Is there an event I can handle? Or maybe a property of the chart I can set? By the way, my chart is constantly getting ticks drawn on it in real time, so I need a solution that is different than catching every paint or invalidate event of my chart. Thanks, Brook Hunter Link to comment Share on other sites More sharing options...
Software FX Posted April 28, 2006 Report Share Posted April 28, 2006 I can not reproduce this behavior. I can show/hide the legend box and the scroll position is kept. Are you setting AxisX.AutoScroll = true ? The only case in which the Scrollbar is affected by turning the legend box on/off is when the scrollbar is near the end. If I remove the legend box, I now have less scroll so the scroll position is adjusted (still at the end but with a value lesser than before), if I turn the legend box back on, then the scrollbar will not be at the end anymore. This behavior is common in scrolling containers, like for instance Visual Studio. As for knowing when the legend box is show/hidden you can capture the InternalCommand event. -- Francisco Padron www.chartfx.com Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.