コード例 #1
0
        private void frmC机械手_MouseDown(object sender, MouseEventArgs e)
        {
            int    i      = 0;
            PointF MouseP = new PointF(e.X, e.Y);;

            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                for (i = ListTuYuan.Count - 1; i > -1; i--)
                {
                    CBase obj = (CBase)ListTuYuan[i];
                    if (obj.ElementType == LCElementType.Ring)
                    {
                        if (obj.Selected(MouseP))
                        {
                            CRing nRing = (CRing)obj;

                            string       sVar = "AV" + nRing.ShowText.PadLeft(3, '0');
                            CStation     Sta  = frmMain.staComm.GetStaByStaName("NJ301");
                            CProtcolFINS SPLC = (CProtcolFINS)Sta;
                            SPLC.SendAODO(sVar, 0, "DO");
                            break;
                        }
                    }
                }
            }
        }
コード例 #2
0
        private void frmChildTran_MouseMove(object sender, MouseEventArgs e)
        {
            Point MouseP = new Point(e.X, e.Y);

            // label1.Location = MouseP;
            // label1.Text =  "(" + MouseP.X.ToString() + "," + MouseP.Y.ToString() + ")";

            for (int i = ListTuYuan.Count - 1; i > -1; i--)
            {
                CBase obj = (CBase)ListTuYuan[i];
                if (obj.ElementType == LCElementType.Ring)
                {
                    if (obj.Selected(MouseP))
                    {
                        this.Cursor = Cursors.Hand;
                        return;
                    }
                }
            }
            this.Cursor = Cursors.Default;
        }