Example #1
0
 private void dbDataGridView_MonitorInfo_CellMouseLeave(object sender, DataGridViewCellEventArgs e)
 {
     if (_customToolTip != null)
     {
         _customToolTip.SetTipInfo(this.dbDataGridView_MonitorInfo, null);
     }
 }
        /// <summary>
        /// 鼠标移动事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void StandarAndSimpleLayout_GridMouseMove(object sender, RectangularGridMouseEventArgs e)
        {
            if (_customToolTip == null)
            {
                _customToolTip                = new CustomToolTip();
                _customToolTip.Owner          = this.ParentForm;
                _customToolTip.TipContentFont = _customToolTipFont;
            }
            if (e.GridInfo == null)
            {
                //当前鼠标移动到的区域无矩形格子
                _customToolTip.SetTipInfo(_standarAndSimpleLayout.DrawPanel, null);
                Debug.WriteLine("进入格子的GridMouseMove事件,并获取的格子信息为空");
                return;
            }

            RectangularGridInfo scanBordGridInfo = _standarAndSimpleLayout[e.GridInfo.Key];
            List <string>       noticeStrList    = null;

            if (scanBordGridInfo != null)
            {
                _tempCustomInfo = (SetCustomObjInfo)scanBordGridInfo.CustomObj;
                if (_tempCustomInfo == null)
                {
                    _customToolTip.SetTipInfo(_standarAndSimpleLayout.DrawPanel, null);
                    return;
                }
                noticeStrList = new List <string>();
                _tempCnt      = _tempCustomInfo.Count;

                noticeStrList.Add(StaticValue.SenderName + ":" + (_tempCustomInfo.ScanBordInfo.SenderIndex + 1));
                noticeStrList.Add(StaticValue.PortName + ":" + (_tempCustomInfo.ScanBordInfo.PortIndex + 1));
                noticeStrList.Add(StaticValue.ScanBoardName + ":" + (_tempCustomInfo.ScanBordInfo.ConnectIndex + 1));
                noticeStrList.Add("(X, Y):(" + e.GridInfo.Region.X + "," + e.GridInfo.Region.Y + ")");
                noticeStrList.Add("(W, H):(" + e.GridInfo.Region.Width + "," + e.GridInfo.Region.Height + ")");
                noticeStrList.Add(StaticValue.CountStr + ":" + _tempCustomInfo.Count);
            }

            _customToolTip.SetTipInfo(_standarAndSimpleLayout.DrawPanel, noticeStrList);
            if (!_customToolTip.TopLevel)
            {
                _customToolTip.TopLevel = true;
            }
        }
        private void SenderStatusUC_MouseMoveInGridEvent(object sender, MouseOperateInGridEventArgs e)
        {
            if (_customToolTip == null)
            {
                _customToolTip                = new CustomToolTip();
                _customToolTip.Owner          = this.ParentForm;
                _customToolTip.TipContentFont = _customToolTipFont;
            }
            if (e.SenderGridInfo == null)
            {
                _customToolTip.SetTipInfo(_senderStatusUC.DrawPanel, null);
                return;
            }
            List <string> noticeStrList = new List <string>();

            noticeStrList.Add(GetLangText("CommPortName", "串口") + ":" + e.SenderGridInfo.CommPort);
            noticeStrList.Add(GetLangText("SenderName", "发送卡") + ":" + (e.SenderGridInfo.SenderIndex + 1).ToString());
            if (e.SenderGridInfo.Status == WorkStatusType.OK)
            {
                noticeStrList.Add(GetLangText("DVISignalOK", "DVI信号:正常"));
                //DVI信号正常时显示发送卡的刷新率
                string refreshReteStr = GetLangText("RefreshRate", "刷新率:");
                if (!e.SenderGridInfo.RefreshRateInfo.IsValid)
                {
                    refreshReteStr += GetLangText("label_Unknown", "未知");
                }
                else
                {
                    refreshReteStr += e.SenderGridInfo.RefreshRateInfo.Value.ToString() + " HZ";
                }
                noticeStrList.Add(refreshReteStr);
            }
            else if (e.SenderGridInfo.Status == WorkStatusType.Error)
            {
                noticeStrList.Add(GetLangText("DVISignalException", "DVI信号:异常"));
            }
            else if (e.SenderGridInfo.Status == WorkStatusType.Unknown)
            {
                noticeStrList.Add(GetLangText("DVISignalUnkonwn", "DVI信号:未知"));
            }
            else if (e.SenderGridInfo.Status == WorkStatusType.SenderCardError)
            {
                noticeStrList.Add(GetLangText("SenderCardUnkonwn", "发送卡:发送卡故障"));
            }
            string msg     = "";
            string portMsg = "";

            if (_tempRedundancyDict != null && _tempRedundancyDict.Count > 0 &&
                _tempRedundancyDict.ContainsKey(e.SenderGridInfo.CommPort))
            {
                if (_tempRedundancyDict[e.SenderGridInfo.CommPort] != null &&
                    _tempRedundancyDict[e.SenderGridInfo.CommPort].Count > 0)
                {
                    foreach (int i in e.SenderGridInfo.RedundantStateTypeList.Keys)
                    {
                        RedundantStateType state = e.SenderGridInfo.RedundantStateTypeList[i];
                        if (state == RedundantStateType.OK)
                        {
                            portMsg = "";
                            msg     = GetLangText("PortNormal", "网口:正常");
                        }
                        else if (state == RedundantStateType.Error)
                        {
                            if (_tempRedundancyDict.ContainsKey(e.SenderGridInfo.CommPort))
                            {
                                for (int j = 0; j < _tempRedundancyDict[e.SenderGridInfo.CommPort].Count; j++)
                                {
                                    SenderRedundancyInfo senderInfo = _tempRedundancyDict[e.SenderGridInfo.CommPort][j];
                                    if (senderInfo.SlaveSenderIndex == e.SenderGridInfo.SenderIndex && senderInfo.SlavePortIndex == i)
                                    {
                                        portMsg = "-" + GetLangText("MasterSenderPort", "主网口:发送卡") + (senderInfo.MasterSenderIndex + 1) + "-" + GetLangText("Port", "网口") + (senderInfo.MasterPortIndex + 1);
                                        msg     = GetLangText("PortRedundant", "网口:冗余");
                                        break;
                                    }
                                    else
                                    {
                                        msg = GetLangText("PortNormal", "网口:正常");
                                    }
                                }
                            }
                        }
                        else if (state == RedundantStateType.Unknown)
                        {
                            portMsg = "";
                            msg     = GetLangText("PortUnknown", "网口:未知");
                        }
                        msg = (i + 1) + msg + portMsg;
                        noticeStrList.Add(msg);
                    }
                }
            }
            _customToolTip.SetTipInfo(_senderStatusUC.DrawPanel, noticeStrList);
            if (!_customToolTip.TopLevel)
            {
                _customToolTip.TopLevel = true;
            }
        }