Exemplo n.º 1
0
 private void 高亮ToolStripMenuItem_Click(object sender, System.EventArgs e)
 {
     if (picElement == null)
     {
         return;
     }
     picElement.HightLight(!picElement.IsHightLight);
 }
Exemplo n.º 2
0
        // 地图点击事件
        private void Map_ElementClickEvent(object sender, MFElementClickEventArgs e)
        {
            if (e.Element == null)
            {
                return;
            }

            switch (e.Element.ElementType)
            {
            case ElementTypeEnum.Picture:
                IMFPicture picture = e.Element as IMFPicture;
                if (picture == null)
                {
                    return;
                }

                if (prevPicture != null)
                {
                    prevPicture.HightLight(false);
                }

                picture.HightLight(true);
                prevPicture = picture;

                if (e.MouseEventArgs.Button == MouseButtons.Right)
                {
                    Point screenLocation = new Point(e.MouseEventArgs.X + this.Parent.Location.X + this.Parent.Parent.Location.X + this.Parent.Parent.Parent.Location.X + this.Parent.Parent.Parent.Parent.Location.X, e.MouseEventArgs.Y + this.Parent.Location.Y + this.Parent.Parent.Location.Y + this.Parent.Parent.Parent.Location.Y + this.Parent.Parent.Parent.Parent.Location.Y);
                    contextMenuStrip1.Show(screenLocation);
                }
                break;

            default:
                if (bEdit == true && e.Element != null)
                {
                    // 只能编辑已绘制的图元
                    var editElement = drawElements.Find(o => o.ElementName == e.Element.ElementName);
                    if (editElement != null)
                    {
                        toolBox.EditElement(editElement);
                    }
                }
                break;
            }
        }