private void showChart(Device d,Point locatioin) { mPbCross.Visible = true; mPbCross.Location = new Point(locatioin.X - 4, locatioin.Y - mPbCross.Height-3); int mainX =mPanelMain.Location.X; int mainY = mPanelMain.Location.Y; int x = mainX+mPbCross.Location.X + mPbCross.Width / 2 - 30; int y = mainY+ mPbCross.Location.Y - mPanelPopChart.Height+3; mPanelPopChart.Location = new Point(x, y); mPanelPopChart.Visible = true; bindChart(d.Id.ToString()); if (type == 1) { mChartTitle.Text = "位移监测点" + d.Mc; } else { mChartTitle.Text = "渗流监测点" + d.Mc; } }
private void LoadDevice() { mDeviceList1 = new List<Device>(); Device device = new Device(); device.Id = 1; device.Mc = "1"; device.X = 139; device.Y = 250; device.Type = 1; mDeviceList1.Add(device); device = new Device(); device.Id = 2; device.Mc = "2"; device.X = 217; device.Y = 247; device.Type = 1; mDeviceList1.Add(device); device = new Device(); device.Id = 3; device.Mc = "3"; device.X = 323; device.Y = 240; device.Type = 1; mDeviceList1.Add(device); device = new Device(); device.Id = 4; device.Mc = "4"; device.X = 423; device.Y = 232; device.Type = 1; mDeviceList1.Add(device); Point point = mDamPic.Location; Size size = mDamPic.Size; foreach (Device d in mDeviceList1) { PictureBox panel = new PictureBox(); panel.Click += panel_Click; panel.MouseEnter += pb_MouseEnter; panel.MouseLeave += pb_MouseLeave; panel.Tag = d.Id; panel.Size = new Size(24, 19); panel.BackColor = Color.Red; int x = (int)(d.X * ((double)size.Width/(double)mOriginW)); int y = (int)(d.Y * ((double)size.Height/(double)mOriginH )); x = x + point.X; y = y + point.Y; panel.Location = new Point(x,y); this.mPanelPic.Controls.Add(panel); panel.BringToFront(); } mDeviceList2 = new List<Device>(); device = new Device(); device.Id = 5; device.Mc = "1"; device.X = 222; device.Y = 378; device.Type = 2; mDeviceList2.Add(device); device = new Device(); device.Id = 6; device.Mc = "2"; device.X = 432; device.Y = 356; device.Type = 2; mDeviceList2.Add(device); foreach (Device d in mDeviceList2) { int x = (int)(d.X * ((double)size.Width / (double)mOriginW)); int y = (int)(d.Y * ((double)size.Height / (double)mOriginH)); x = x + point.X; y = y + point.Y; PictureBox pb = new PictureBox(); pb.Click += panel_Click; pb.MouseEnter += pb_MouseEnter; pb.MouseLeave += pb_MouseLeave; pb.Tag = d.Id; pb.BackColor = Color.Transparent; pb.Image = global::com.tk.dam.Properties.Resources.GNSSXB; pb.Size = new Size(24, 19); pb.Location = new Point(x, y); this.mDamPic.Controls.Add(pb); pb.Parent = mDamPic; pb.BringToFront(); } }