Page 1 of 1

Map double click event question

Posted: Thu Jan 18, 2007 5:30 am
by 9643419
Below code is not work,How fire click and double click event of a map?

private void map1_Click(object sender, System.Windows.Forms.MouseEventArgs e)
{
MessageBox.Show("Shape: "+map1.Labels[ map1.Clicked(e.X, e.Y)]+ " Value: "+map1.ZValues[ map1.Clicked(e.X, e.Y)].ToString());
tChart1.Chart.CancelMouse=true;
}

private void map1_DblClick(object sender, MouseEventArgs e)
{
MessageBox.Show("Shape: "+map1.Labels[ map1.Clicked(e.X, e.Y)]+ " Value: "+map1.ZValues[ map1.Clicked(e.X, e.Y)].ToString());
tChart1.Chart.CancelMouse=true;
}



Best Regards!!

Posted: Thu Jan 18, 2007 9:47 am
by 9348258
Hi wilcohsu

You can't do a map1_Click and map1_DblClick simultaneously because map1_Click will always be executed before map1_DblClick. Also, series' double click event doesn't work, this is a problem we recently found and is on of the most prioritary bug to fix for the next release.

In the meantime, as a workaround you can implement double click event for series doing something like this:

Code: Select all

private void tChart1_DoubleClick(object sender, EventArgs e)
        {
            if (map1.Clicked(X, Y) != -1)
            {
                MessageBox.Show("Shape: " + map1.Labels[map1.Clicked(X, Y)] + " Value: " + map1.ZValues[map1.Clicked(X, Y)].ToString());
                tChart1.Chart.CancelMouse = true;
            }       
        }

        private int X,Y;

        private void tChart1_MouseDown(object sender, MouseEventArgs e)
        {
            X = e.X;
            Y = e.Y;
        }