//初始化 private void loadData() { if (cengjiID == null || quYuBean == null || ckdBeans == null) { return; } this.Text = quYuBean.QuyuName; loadImage(); if (ckdBeans.Count < 1) { return; } locaModel.Ckds.Clear(); foreach (CanKaoDianBean ckdBean in ckdBeans) { if (!quYuBean.QuyuID.Equals(ckdBean.QuYuID) || !cengjiID.Equals(ckdBean.CenJiID)) { continue; } CanKaoDianView cView = new CanKaoDianView(); cView.BackColor = Color.Transparent; Point p = new Point(ckdBean.POint.X * panel1.Width / getcolWeiHei(ckdBean.ColWeiHei[0]), ckdBean.POint.Y * panel1.Height / getcolWeiHei(ckdBean.ColWeiHei[1])); cView.Click += button1_Click; cView.Location = p; cView.LabText = ckdBean.Name; cView.Tag = ckdBean.Id; cView.CkdIDStr = ckdBean.Id; locaModel.cardCountHandle += cView.setCardCount; panel1.Controls.Add(cView); CanKaoDianBean ckdnewBean = new CanKaoDianBean(ckdBean); locaModel.Ckds.Add(ckdnewBean); } }
private void CanKaoDianViewMouseDown(object sender, MouseEventArgs e) { if (!(sender is CanKaoDianView)) { return; } CanKaoDianView cView = (CanKaoDianView)sender; ControlMoveResize(cView, panel1); }
private void addCkdView(CanKaoDianBean cdBean) { CanKaoDianView ckdView = cssCon.canKaoDianAdd(panel1, cdBean, comboBox4.Text, comboBox5.Text); if (ckdView != null) { ckdView.ViewEnable(); ckdView.MouseDown += new MouseEventHandler(CanKaoDianViewMouseDown); ckdView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(CKDView_mouDouble); } }
/// <summary> /// 双击控件发生 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void CKDView_mouDouble(object sender, MouseEventArgs e) { if (!(sender is CanKaoDianView)) { return; } CanKaoDianView cView = (CanKaoDianView)sender; SetCanKaoDianFrom sckFrom = new SetCanKaoDianFrom(cView.Location, cView.CkdID); sckFrom.onSetCanKaoHandle += setCanKAOdian; sckFrom.Show(); }
//参考点的点击事件 private void button1_Click(object sender, EventArgs e) //添加 { if (!(sender is CanKaoDianView)) { return; } CanKaoDianView cView = (CanKaoDianView)sender; PortFrom portFrom = new PortFrom((string)cView.Tag); portFrom.NodeName = cView.LabText; cardHand += portFrom.cardList; portFrom.cardHand += setTag_LEDShow; portFrom.ShowDialog(); }
private void canMouseUp(object sender, MouseEventArgs e) { if (Containe == null) { return; } if (this.IsMoving) { if (pCursorOffset.X == 0 && pCursorOffset.Y == 0) { return; } if ((pCtrlLastCoordinate.X + pCursorOffset.X + ctrl.Width) > 0) { ctrl.Left = pCtrlLastCoordinate.X + pCursorOffset.X; } else { ctrl.Left = 0; } if ((pCtrlLastCoordinate.Y + pCursorOffset.Y + ctrl.Height) > 0) { ctrl.Top = pCtrlLastCoordinate.Y + pCursorOffset.Y; } else { ctrl.Top = 0; } pCursorOffset.X = 0; pCursorOffset.Y = 0; ctrl.MouseDown -= new MouseEventHandler(canMouseDown); ctrl.MouseMove -= new MouseEventHandler(canMouseMove); ctrl.MouseUp -= new MouseEventHandler(canMouseUp); if (!(ctrl is CanKaoDianView)) { return; } CanKaoDianView ct = (CanKaoDianView)ctrl; cssCon.canKaoDianMove(ctrl.Location, ct.LabText, comboBox4.Text, comboBox5.Text, panel1.Width, panel1.Height); } }
private void comboBox5_SelectedIndexChanged(object sender, EventArgs e) { if (panel1.Controls.Count > 0) { panel1.Controls.Clear(); } cssCon.comItemSelect2(comboBox4, comboBox5, textBox10, panel1); if (panel1.Controls.Count < 1) { return; } foreach (Control col in panel1.Controls) { if (!(col is CanKaoDianView)) { continue; } CanKaoDianView cView = (CanKaoDianView)col; //cView.Click += new System.EventHandler(this.CanKaoDianView_Click); cView.ViewEnable(); cView.MouseDown += new MouseEventHandler(CanKaoDianViewMouseDown); cView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(CKDView_mouDouble); } }