Hit CursorTool with ContextMenuStrip
Posted: Wed Jan 16, 2008 7:33 am
Good morning!
I am showing a ContextMenuStrip on my chart when pressing the right mousebutton. What I want now is, that there shows up an additional MenuItem if the mouspointer is located over a CursorTool while opening the ContextMenuStrip.
That works fine if the chart is the only component in the application but if not, the location of the ContextMenuStrip does not correspond to the position of the CursorTool as the CursorTool seems to be located relatively to the upper left corner of the chart but the ContextMenuStrip is located relatively to the upper left corner of the application window.
I tried to determine the real position of the CursorTool by the following code:
The difference between xPos and contextMenuStrip1.Left seems to be the width of components located left to the chart.
To cut a long story short: How can I come to the desired result?
best wishes,
Rf.
I am showing a ContextMenuStrip on my chart when pressing the right mousebutton. What I want now is, that there shows up an additional MenuItem if the mouspointer is located over a CursorTool while opening the ContextMenuStrip.
Code: Select all
for (int i = 0; (i < isgChart1.mCursorCounter) && (hitScooter == -1); i++)
if (((Steema.TeeChart.Tools.CursorTool)isgChart1.mCursorCollection[i]).Clicked(contextMenuStrip1.Left, contextMenuStrip1.Top) != Steema.TeeChart.Tools.CursorClicked.None)
{
hitScooter = i;
}
}
deleteScooterToolStripMenuItem.Visible = (hitScooter != -1);
}
I tried to determine the real position of the CursorTool by the following code:
Code: Select all
int xPos=0;
int yPos=0;
for (int i = 0; (i < isgChart1.mCursorCounter) && (hitScooter == -1); i++)
{
for (int x = 0; x < 1300; x += 2)
{
for (int y = 0; y < 1100; y += 50)
{
if ((isgChart1.mCursorCollection[i] != null) && (((Steema.TeeChart.Tools.CursorTool)isgChart1.mCursorCollection[i]).Clicked(x, y) != Steema.TeeChart.Tools.CursorClicked.None))
{
xPos=x;
yPos=y;
}
}
}
}
To cut a long story short: How can I come to the desired result?
best wishes,
Rf.