public MainWin() { ///p为三点中点 UnitPoint p = HitUtil.CenterPointFrom3Points(new UnitPoint(0, 2), new UnitPoint(1.4142136f, 1.4142136f), new UnitPoint(2, 0)); InitializeComponent(); Text = Program.AppName; //设置窗口名称 string[] args = Environment.GetCommandLineArgs(); //从某个文件打开时参数会有两个 if (args.Length == 2) // assume it points to a file { OpenDocument(args[1]); } else { OpenDocument(string.Empty); } m_menuItems = new MenuItemManager(this); m_menuItems.SetupStripPanels(); //初始化上下左右四个工具面板 SetupToolbars(); //安装三个工具栏 Application.Idle += new EventHandler(OnIdle); //添加触发,不断刷新三个控件 }
/// <summary> /// status为状态,答题时,testID绘图题第几题,id为卷名,stuID为姓名 /// 出题时,testID为题库题目ID /// 标准答案时,testID为题库题目ID /// </summary> /// <param name="status"></param> /// <param name="examName"></param> /// <param name="testId"></param> public MainWin(string status, string examName, string testID, string stuID, string stuName, string className, string school) { this.examName = examName; this.testID = testID; this.status = status; this.stuID = stuID; this.stuName = stuName; this.className = className; this.school = school; ///p为三点中点 UnitPoint p = HitUtil.CenterPointFrom3Points(new UnitPoint(0, 2), new UnitPoint(1.4142136f, 1.4142136f), new UnitPoint(2, 0)); InitializeComponent(); Text = Program.AppName; //设置窗口名称 string[] args = Environment.GetCommandLineArgs(); //从某个文件打开时参数会有两个 if (args.Length == 2) // assume it points to a file { OpenDocument(args[1], status); } else { OpenDocument(string.Empty, status); } m_menuItems = new MenuItemManager(this); m_menuItems.SetupStripPanels(); //初始化上下左右四个工具面板 SetupToolbars(); //安装三个工具栏 Application.Idle += new EventHandler(OnIdle); //添加触发,不断刷新三个控件 if (status.Equals("答题")) { string sql = "declare @num int " + "exec @num = findOrderNum '" + examName + "'," + testID + " " + "print @num " + "select 作图题题目 from 作图题库 where id=@num"; OnFileOpen(sql); } if (status.Equals("修改答案")) { string sql = "use [CAD__" + school + "] select 画图题答案" + testID + " from testScore_" + examName + " where 学号='" + this.stuID + "'"; OnFileOpen(sql); } if (status.Equals("标准答案")) { string sql = "select 作图题题目 from 作图题库 where id=" + testID; OnFileOpen(sql); //OpenDocument("D://9.cadxml", status); } }
public MainWin() { UnitPoint p = HitUtil.CenterPointFrom3Points(new UnitPoint(0, 2), new UnitPoint(1.4142136f, 1.4142136f), new UnitPoint(2, 0)); InitializeComponent(); Text = Program.AppName; string[] args = Environment.GetCommandLineArgs(); if (args.Length == 2) // assume it points to a file { OpenDocument(args[1]); } else { OpenDocument(string.Empty); } m_menuItems = new MenuItemManager(this); m_menuItems.SetupStripPanels(); SetupToolbars(); Application.Idle += new EventHandler(OnIdle); }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (e.Button == MouseButtons.Right) { CommandEscape(); } if (m_commandType == eCommandType.pan) { m_panOffset.X += m_dragOffset.X; m_panOffset.Y += m_dragOffset.Y; m_dragOffset = new PointF(0, 0); } List <IDrawObject> hitlist = null; Rectangle screenSelRect = Rectangle.Empty; if (m_selection != null) { screenSelRect = m_selection.ScreenRect(); RectangleF selectionRect = m_selection.Selection(m_canvaswrapper); if (selectionRect != RectangleF.Empty) { // is any selection rectangle. use it for selection hitlist = m_model.GetHitObjects(m_canvaswrapper, selectionRect, m_selection.AnyPoint()); DoInvalidate(true); } else { // else use mouse point UnitPoint mousepoint = ToUnit(new PointF(e.X, e.Y)); hitlist = m_model.GetHitObjects(m_canvaswrapper, mousepoint); HitUtil.ActivateSymbolAtPoint(m_canvaswrapper, hitlist, mousepoint); } m_selection = null; } if (m_commandType == eCommandType.select) { if (hitlist != null) { HandleSelection(hitlist); } } if (m_commandType == eCommandType.edit && m_editTool != null) { UnitPoint mousepoint = ToUnit(m_mousedownPoint); if (m_snappoint != null) { mousepoint = m_snappoint.SnapPoint; } if (screenSelRect != Rectangle.Empty) { m_editTool.SetHitObjects(mousepoint, hitlist); } m_editTool.OnMouseUp(m_canvaswrapper, mousepoint, m_snappoint); } if (m_commandType == eCommandType.draw && m_newObject != null) { UnitPoint mousepoint = ToUnit(m_mousedownPoint); if (m_snappoint != null) { mousepoint = m_snappoint.SnapPoint; } m_newObject.OnMouseUp(m_canvaswrapper, mousepoint, m_snappoint); } }