Dear Support Team,
I have a vertical cursor in chart, and I only want to move the cursor tool by pressed left mouse. I don't want to move the cursor by pressed right mouse.
Could you please help me to solve this issue?
Now we can move the cursor by both pressed left and right mouse.
Thank you!
Disable right mouse for cursor tool moving
Re: Disable right mouse for cursor tool moving
Hello tomking,
I have made a simple project using MouseDown and MouseMove events to disable drag of cursor when you click RightMouse.
Could you tell us if previous code works as you want? Moreover also you can use ColorLine Tool and disable AllowDrag property when you click buttonRigh using Mouse events.
I hope will helps.
Thanks,
I have made a simple project using MouseDown and MouseMove events to disable drag of cursor when you click RightMouse.
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
Steema.TeeChart.Styles.Line lineSeries1;
Steema.TeeChart.Tools.CursorTool cursor;
private void InitializeChart()
{
lineSeries1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
lineSeries1.FillSampleValues();
cursor = new Steema.TeeChart.Tools.CursorTool(tChart1.Chart);
cursor.Style = Steema.TeeChart.Tools.CursorToolStyles.Vertical;
tChart1.MouseDown += new MouseEventHandler(tChart1_MouseDown);
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
}
int X;
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
cursor.XValue = tChart1.Axes.Bottom.CalcPosPoint(X);
}
}
void tChart1_MouseDown(object sender, MouseEventArgs e)
{
X = e.X;
}
I hope will helps.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Disable right mouse for cursor tool moving
Dear Sandra,
Thank for your replying.
It work if we do right mouse down and keep pressed mouse. But it does not work as my request.
When I do mouse down click by right mouse button on the cursor tool and then do mouse up. The cursor tool follows the mouse until the we do left mouse click.
I don't want the cursor tool follow the mouse after I do mouse up event.
If you have any solution for this issue. Please help me!
Thanks
Thank for your replying.
It work if we do right mouse down and keep pressed mouse. But it does not work as my request.
When I do mouse down click by right mouse button on the cursor tool and then do mouse up. The cursor tool follows the mouse until the we do left mouse click.
I don't want the cursor tool follow the mouse after I do mouse up event.
If you have any solution for this issue. Please help me!
Thanks
Re: Disable right mouse for cursor tool moving
Hello tomking,
I have tested again my code and works fine for me. If you can take a look in my code you can see that I am using FollowMouse and FastCursor properties with their default values that in this case are false. So if you don't want that cursorTool follows cursor after do click with right button you need disable FollowMouse. You can disable it, in MouseClick event for example, as do in next lines of code:
Could you confirm us if previous code works as you expected? On the other hand, can you tell us which version of TeeChart are you using now?
I hope will helps.
Thanks,
I have tested again my code and works fine for me. If you can take a look in my code you can see that I am using FollowMouse and FastCursor properties with their default values that in this case are false. So if you don't want that cursorTool follows cursor after do click with right button you need disable FollowMouse. You can disable it, in MouseClick event for example, as do in next lines of code:
Code: Select all
void tChart1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
cursor.FollowMouse = false;
}
else if (e.Button == MouseButtons.Left)
{
cursor.FollowMouse = true;
}
}
int X;
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
cursor.XValue = tChart1.Axes.Bottom.CalcPosPoint(X);
}
}
void tChart1_MouseDown(object sender, MouseEventArgs e)
{
X = e.X;
}
I hope will helps.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Disable right mouse for cursor tool moving
Hello Sandra,
Actually, It has worked well since applied your first code.
The problem is that I assigned a context menu into the Tchat control. So when I do right mouse click and do mouse up, the cursor will still follow the mouse.
So I rejected the context menu and display it in manual way.
I have fixed this issue.
Thank you very much!
Actually, It has worked well since applied your first code.
The problem is that I assigned a context menu into the Tchat control. So when I do right mouse click and do mouse up, the cursor will still follow the mouse.
So I rejected the context menu and display it in manual way.
I have fixed this issue.
Thank you very much!