I am doing an indicator for displaying the mouse coordinates in MouseMove event.
The indicator calls the method "chart_MouseMove" when the mouse is moved but the text isn't updated.
Is there any way for calling to Plot method ?
Now the indicator works fine only when clickmouse or Alt+Tab windows or key press.
( I know that this doubt is beyond the scope of what you provide support for but I would be very grateful if you could help me ).
Thanks very much.
protectedoverridevoid OnBarUpdate()
{
if ((ChartControl != null) && (!_initMouseEvents))
{
this.ChartControl.ChartPanel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove);
_initMouseEvents = true;
}
}
publicoverridevoid Plot(Graphics graphics, Rectangle bounds, double min, double max)
{
_boundsChart = bounds;
_minChartPrice = min;
_maxChartPrice = max;
graphics.DrawString( "Y: " + _mouseOffset, fontTexto, brushTexto, 10, 280 );
}
privatevoid chart_MouseMove(object sender, MouseEventArgs e)
{
if (ChartControl != null)
{
double price1 = ConvertYtoPrice ( e.Y );
_mouseOffset = price1 ;
}
}
privatedouble ConvertYtoPrice (int i)
{
int _tickLength=0;
if (TickSize < 1)
_tickLength = TickSize.ToString ().Length-2;
double chartscale = Math.Abs (_maxChartPrice - _minChartPrice);
double boundAreaScale = _boundsChart.Bottom - _boundsChart.Y ;
double ratio = (double)(chartscale)/ boundAreaScale ;
double chartPrice = Math.Round ( (_minChartPrice ) + ((_boundsChart.Bottom -i) * ratio), _tickLength);
return chartPrice;
}
Comment