Exemplo n.º 1
0
        /// <summary>
        /// 画坐标值
        /// </summary>
        /// <param name="p_objGraphic"></param>
        private void m_mthDrawParamsValue(Graphics p_objGraphic)
        {
            try
            {
                if (m_objParamValueArr != null)
                {
                    for (int i = 0; i < m_objParamValueArr.Length; i++)
                    {
                        if (m_objParamValueArr[i] != null)
                        {
                            clsVitalGroupSet objVitalGroupSet = m_objParamValueArr[i].m_objVitalGroupSet;

                            if (objVitalGroupSet != null)
                            {
                                Pen      objPenLine  = new Pen(objVitalGroupSet.m_clrColor);
                                PointF[] pnfValueArr = (PointF[])m_objParamValueArr[i].m_arlValue.ToArray(typeof(PointF));

                                if (pnfValueArr == null || pnfValueArr.Length == 0)
                                {
                                    continue;
                                }

                                switch (m_EnmDisplay)                                //显示方式
                                {
                                case enmDisplay.Continues:                           //连续
                                    if (pnfValueArr.Length > 1)
                                    {
                                        p_objGraphic.DrawLines(objPenLine, pnfValueArr);
                                    }
                                    break;

                                case enmDisplay.Scatter:                                         //离散
                                    for (int j = 0; j < pnfValueArr.Length; j++)
                                    {
                                        m_mthDrawMarker(p_objGraphic, pnfValueArr[j], objVitalGroupSet.m_intMarkerIndex, objVitalGroupSet.m_clrColor);
                                    }
                                    break;

                                case enmDisplay.Mixed:                                         //混合
                                    for (int j = 0; j < pnfValueArr.Length; j++)
                                    {
                                        m_mthDrawMarker(p_objGraphic, pnfValueArr[j], objVitalGroupSet.m_intMarkerIndex, objVitalGroupSet.m_clrColor);
                                    }
                                    if (pnfValueArr.Length > 1)
                                    {
                                        p_objGraphic.DrawLines(objPenLine, pnfValueArr);
                                    }
                                    break;
                                }
                            }
                        }
                    }                    //end for
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 鼠标移动到点上时,显示该点的值和采集时间,只对离散和混合的显示方式有效
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void picChart_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (!m_blnShowTrend)
            {
                return;
            }

            if (m_enmDisplay == enmDisplay.Continues)
            {
                return;
            }

            string strToolTipText = "";

            if (m_objParamValueArr != null)
            {
                for (int i = 0; i < m_objParamValueArr.Length; i++)
                {
                    if (m_objParamValueArr[i] != null)
                    {
                        PointF[] pnfValueArr = (PointF[])m_objParamValueArr[i].m_arlValue.ToArray(typeof(PointF));

                        for (int j = 0; j < pnfValueArr.Length; j++)
                        {
                            //判断鼠标的位置是否在点的范围内
                            if (e.X >= pnfValueArr[j].X - 2 && e.X <= pnfValueArr[j].X + 2 && e.Y >= pnfValueArr[j].Y - 2 && e.Y <= pnfValueArr[j].Y + 2)
                            {
                                clsVitalGroupSet objVitalGroup = m_objParamValueArr[i].m_objVitalGroupSet;
                                clsTrendValue    objTrendValue = (clsTrendValue)m_objParamValueArr[i].m_arlTrendValue[j];

                                if (objVitalGroup == null || objTrendValue == null)
                                {
                                    continue;
                                }

                                strToolTipText += objVitalGroup.m_strParamLabel + " : ";
                                strToolTipText += objTrendValue.m_fltValue.ToString() + "  ";
                                strToolTipText += objVitalGroup.m_strUnitDesc + "\r\n";
                                strToolTipText += "采集时间:" + objTrendValue.m_dtmStoreDate.ToString("yyyy-MM-dd HH:mm:ss") + "\r\n";
                            }
                        }
                    }            //end for j
                }                //end for i

                if (strToolTipText != null && strToolTipText != "")
                {
                    ttpInfo.SetToolTip(this.picChart, strToolTipText);
                }
            }
        }