通过查看超图的示例代码,发现可以在子程序中实现主窗体的mapcontrol_mousedown事件,但是自己尝试一直不成功,想知道是如何实
/// <summary>
/// MapControl MouseDown事件。
/// MouseDown event of MapControl
/// </summary>
private void m_mapControl_MouseDown(object sender, MouseEventArgs e)//在子程序里如何编写实现
{
try
{
if (e.Button == MouseButtons.Left)
{
Point point = new Point(e.X, e.Y);
Point2D mapPoint = m_mapControl.Map.PixelToMap(point);
if (m_mapControl.Map.Bounds.Contains(mapPoint))
{
if ((m_mapControl.Action == SuperMap.UI.Action.Select
|| m_mapControl.Action == SuperMap.UI.Action.Select2)
&& m_selectMode == SelectMode.SelectPoint)
{
AddPoint(mapPoint);
}
}
}
}
catch (Exception ex)
{
Trace.WriteLine(ex.Message);
}
}
现在子程序中编写主窗体的mapcontrol_mousedown事件的。