示例#1
0
        /// <summary>
        /// 添加标注
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        static void mi8_OnClick(object sender, EventArgs e)
        {
            var g3eObject = new G3EObject();

            if (DBEntityFinder.Instance.GetG3EIds(objectId, ref g3eObject))
            {
                var ee = new FixEntityArgs
                {
                    g3eObject = g3eObject,
                    ObjId     = objectId
                };
                if (AddLabelHandler != null)
                {
                    AddLabelHandler(new object(), ee);
                }
            }
        }
示例#2
0
        public static void Application_PreTranslateMessage(object sender, PreTranslateMessageEventArgs e)
        {
            try
            {
                if (acadApp.DocumentManager.MdiActiveDocument != null)
                {
                    var ed = acadApp.DocumentManager.MdiActiveDocument.Editor;
                    switch (e.Message.message)
                    {
                    case WM_SYSKEYDOWN:
                        if (e.Message.wParam.ToInt32() == 65)
                        {
                            ObjectContextMenu.AddOrRefreshConnectCtr(true);
                        }
                        else if (e.Message.wParam.ToInt32() == 88)
                        {
                            ObjectContextMenu.ShowBulkChange();
                        }
                        else if (e.Message.wParam.ToInt32() == 81)
                        {
                            PublicMethod.Instance.SendCommend("pan\n");
                        }
                        break;

                    case WM_MOUSEWHEEL:
                        //System.Windows.Forms.MessageBox.Show("你在CAD操作中转动滚轮了!");
                        showmap();
                        break;

                    case WM_MOUSEMOVE:
                        // System.Windows.Forms.MessageBox.Show("你在CAD操作中移动鼠标了!");
                        break;

                    case WM_LBUTTONDOWN:
                        //System.Windows.Forms.MessageBox.Show("你在CAD操作中按下左键了!");
                        point = ed.PointToWorld(new Point(e.Message.pt_x, e.Message.pt_y));
                        var leftbuttondown = new FixEntityArgs {
                            Position = point
                        };
                        if (LeftButtonDownEventHander != null)
                        {
                            LeftButtonDownEventHander(new object(), leftbuttondown);
                        }
                        break;

                    case WM_LBUTTONUP:
                        //System.Windows.Forms.MessageBox.Show("你在CAD操作中弹起左键了!");
                        if (bpan)
                        {
                            showmap();
                        }
                        break;

                    case WM_MBUTTONUP:
                        //System.Windows.Forms.MessageBox.Show("你在CAD操作中弹起中键了!");
                        showmap();
                        break;
                    }
                }
            }
            catch (System.Exception ex)
            {
                //LogManager.Instance.Error(ex);
            }
        }
示例#3
0
        /// 鼠标单击实体调用属性
        public static void ShowAttribute(ObjectId objectId)
        {
            int[] fnoList = { 142, 149, 163 };
            try
            {
                var entity = PublicMethod.Instance.GetObject(objectId, OpenMode.ForRead) as Entity;
                if (entity != null)
                {
                    var g3eObject = new G3EObject();
                    if (DBEntityFinder.Instance.GetG3EIds(entity.ObjectId, ref g3eObject))
                    {
                        //杂标
                        //if (g3eObject.G3E_FNO == 250) return;
                        var ee = new FixEntityArgs
                        {
                            g3eObject = g3eObject,
                            ObjId     = entity.ObjectId,
                        };

                        #region

                        //如果不是低压集中抄表箱和单选就使右键菜单变为灰色
                        if ((g3eObject.G3E_FNO == 159) /*&& mouse._selectedObjectIds.Count() == 1*/)
                        {
                            mi7.Enabled = true;
                        }
                        else
                        {
                            mi7.Enabled = false;
                        }
                        //如果不是变压器、计量柜和单选就使右键菜单变为灰色
                        if ((g3eObject.G3E_FNO == 148 || g3eObject.G3E_FNO == 84) /*&& mouse._selectedObjectIds.Count() == 1*/)
                        {
                            mi8.Enabled = true;
                        }
                        else
                        {
                            mi8.Enabled = false;
                        }
                        if (fnoList.Any(o => o == g3eObject.G3E_FNO))
                        {
                            mi6.Enabled = true;
                        }
                        else
                        {
                            mi6.Enabled = false;
                        }

                        #endregion
                        ee.devname = entity.Layer;
                        if (FixEntityHandler != null)
                        {
                            FixEntityHandler(new object(), ee);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                PublicMethod.Instance.ShowMessage("鼠标单击实体调用属性错误");
                LogManager.Instance.Error(ex.Message);
            }
        }