// /// <summary> /// 将监测点位信息的属性值显示在窗口界面中 /// </summary> /// <param name="PointsInfo"></param> /// <remarks></remarks> private void PointsInfoToUI(ClsDrawing_PlanView.MonitorPointsInformation PointsInfo) { ClsDrawing_PlanView.MonitorPointsInformation with_1 = PointsInfo; this.txtbx_ShapeName_MonitorPointTag.Text = with_1.ShapeName_MonitorPointTag; this.txtbx_Pt_BL_ShapeID.Text = System.Convert.ToString(with_1.pt_Visio_BottomLeft_ShapeID); this.txtbx_Pt_UR_ShapeID.Text = System.Convert.ToString(with_1.pt_Visio_UpRight_ShapeID); this.txtbx_Pt_BL_CAD_X.Text = System.Convert.ToString(with_1.pt_CAD_BottomLeft.X); this.txtbx_Pt_BL_CAD_Y.Text = System.Convert.ToString(with_1.pt_CAD_BottomLeft.Y); this.txtbx_Pt_UR_CAD_X.Text = System.Convert.ToString(with_1.pt_CAD_UpRight.X); this.txtbx_Pt_UR_CAD_Y.Text = System.Convert.ToString(with_1.pt_CAD_UpRight.Y); }
/// <summary> /// 构造函数 /// </summary> /// <param name="PaintingPage">监测点位所要绘制的Visio图形对象</param> /// <param name="wkshtPoints">存放监测点位信息的Excel表格</param> /// <remarks></remarks> public DiaFrm_PointsTreeView(Microsoft.Office.Interop.Excel.Worksheet wkshtPoints, ClsDrawing_PlanView PaintingPage) { // This call is required by the designer. InitializeComponent(); // Add any initialization after the InitializeComponent() call. this.F_PaintingPage = PaintingPage; this.F_MonitorPointsInfo = PaintingPage.MonitorPointsInfo; this.F_wkshtPoints = wkshtPoints; }
/// <summary> /// 生成开挖平面图 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks></remarks> public void ConstructVisioPlanView(object sender, EventArgs e) { //检查程序中是否已经有了打开的Visio绘图 if (GlobalApplication.Application.PlanView_VisioWindow == null) { string VsoFilepath = this.TextBoxFilePath.Text; bool blnFilePathValidated = false; if (VsoFilepath.Length > 0) { if (File.Exists(VsoFilepath)) { if (Path.GetExtension(VsoFilepath) == ".vsd") { blnFilePathValidated = true; } } } if (blnFilePathValidated) { try { this.Hide(); ClsDrawing_PlanView.MonitorPointsInformation PointsInfo = null; //提取监测点位的信息 if (F_HasMonitorPointinfos) { PointsInfo = UIToPointsInfo(); } //提取开挖平面图的信息 ClsDrawing_PlanView visioWindow = new ClsDrawing_PlanView(strFilePath: ref VsoFilepath, type: DrawingType.Vso_PlanView, PageName_PlanView: this.TextBoxPageName.Text, ShapeID_AllRegions: this.TextBoxAllRegions.Text, InfoBoxID: this.TextBoxInfoBoxID.Text, HasMonitorPointsInfo: ref this.F_HasMonitorPointinfos, MonitorPointsInfo: ref PointsInfo); this.Close(); } catch (Exception) { MessageBox.Show("Visio平面图打开出错,请重新打开。", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Visible = true; GlobalApplication.Application.PlanView_VisioWindow = null; } } else { MessageBox.Show("Visio文档不符合规范,请重新选择。", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } else { //不能打开多个Visio平面图 MessageBox.Show("Visio平面图已经打开。", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }
/// <summary> /// 程序的一些属性的初始值的设置,这些属性是与UI线程无关的属性,以在新的非UI线程中进行设置。 /// </summary> /// <remarks></remarks> private void myDefaltSettings() { mySettings_Application setting1 = new mySettings_Application(); ClsDrawing_PlanView.MonitorPointsInformation @struct = new ClsDrawing_PlanView.MonitorPointsInformation(); @struct.ShapeName_MonitorPointTag = "Tag"; @struct.pt_CAD_BottomLeft = new PointF(309598.527F, -119668.436F); @struct.pt_CAD_UpRight = new PointF(536642.644F, 201852.14F); @struct.pt_Visio_BottomLeft_ShapeID = 197; @struct.pt_Visio_UpRight_ShapeID = 217; setting1.MonitorPointsInfo = @struct; //在下面的Save方法中,不知为何为出现两次相同的报错:System.IO.FileNotFoundException //可以明确其于多线程无关,但是好在此异常对于程序的运行无影响。 setting1.Save(); }
/// <summary> /// 根据窗口界面中输入的监测点位数据,来返回对应的结构体属性。 /// </summary> /// <returns></returns> /// <remarks></remarks> private ClsDrawing_PlanView.MonitorPointsInformation UIToPointsInfo() { ClsDrawing_PlanView.MonitorPointsInformation PointsInfo = new ClsDrawing_PlanView.MonitorPointsInformation(); try { PointsInfo.ShapeName_MonitorPointTag = this.txtbx_ShapeName_MonitorPointTag.Text; PointsInfo.pt_CAD_BottomLeft = new PointF(float.Parse(this.txtbx_Pt_BL_CAD_X.Text), float.Parse(this.txtbx_Pt_BL_CAD_Y.Text)); PointsInfo.pt_CAD_UpRight = new PointF(float.Parse(this.txtbx_Pt_UR_CAD_X.Text), float.Parse(this.txtbx_Pt_UR_CAD_Y.Text)); PointsInfo.pt_Visio_BottomLeft_ShapeID = int.Parse(this.txtbx_Pt_BL_ShapeID.Text); PointsInfo.pt_Visio_UpRight_ShapeID = int.Parse(this.txtbx_Pt_UR_ShapeID.Text); } catch (Exception) { MessageBox.Show("测点绘制与定位的数据格式不正确,请调整", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(new ClsDrawing_PlanView.MonitorPointsInformation()); } return(PointsInfo); }