示例#1
0
 protected override void OnMouseDown(MouseEventArgs e)
 {
     if (m_xRange != null)
     {
         int nWidth = Width / 3;
         int nIndex = (int)(e.X / nWidth);
         m_nSelect = nIndex;
         if (nIndex == 1)
         {
             if (m_dCalL != 0)
             {
                 frmInput fInput = new frmInput();
                 fInput.Value  = m_xRange.L * m_dCalL;
                 fInput.Min    = m_dMinL;
                 fInput.Max    = m_dMaxL;
                 fInput.Format = m_sFormatL;
                 if (DialogResult.OK == fInput.ShowDialog(this))
                 {
                     m_xRange.L = fInput.Value / m_dCalL;
                     if (Change != null)
                     {
                         Change(this);
                     }
                     Refresh();
                 }
                 fInput.Dispose();
             }
         }
         if (nIndex == 2)
         {
             if (m_dCalH != 0)
             {
                 frmInput fInput = new frmInput();
                 fInput.Value  = m_xRange.H * m_dCalH;
                 fInput.Min    = m_dMinH;
                 fInput.Max    = m_dMaxH;
                 fInput.Format = m_sFormatH;
                 if (DialogResult.OK == fInput.ShowDialog(this))
                 {
                     m_xRange.H = fInput.Value / m_dCalH;
                     if (Change != null)
                     {
                         Change(this);
                     }
                     Refresh();
                 }
                 fInput.Dispose();
             }
         }
     }
 }
示例#2
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (m_Object != null)
            {
                if (m_dCal != 0)
                {
                    int nWidth = Width / 2;
                    if ((e.X / nWidth) == 1)
                    {
                        frmInput fInput = new frmInput();

                        switch (m_sType)
                        {
                        case "Int16":
                        {
                            int nVal = (int)Value;
                            fInput.Value = nVal * m_dCal;
                        } break;

                        case "Int32":
                        {
                            int nVal = (int)Value;
                            fInput.Value = nVal * m_dCal;
                        } break;

                        case "Double":
                        {
                            double dVal = (double)Value;
                            fInput.Value = dVal * m_dCal;
                        } break;
                        }


                        fInput.Min    = m_dMin;
                        fInput.Max    = m_dMax;
                        fInput.Format = m_sFormat;
                        if (DialogResult.OK == fInput.ShowDialog(this))
                        {
                            double dVal = fInput.Value / m_dCal;

                            switch (m_sType)
                            {
                            case "Int16":
                            {
                                int nVal = (int)dVal;
                                Value = nVal;
                            } break;

                            case "Int32":
                            {
                                int nVal = (int)dVal;
                                Value = nVal;
                            } break;

                            case "Double":
                            {
                                Value = dVal;
                            } break;
                            }
                            if (Change != null)
                            {
                                Change(this);
                            }
                            Refresh();
                        }
                        fInput.Dispose();
                    }
                    else
                    {
                        string sMsg;
                        sMsg = string.Format("Set = " + m_sFormat + " Are you sure?", m_dNom * m_dCal);
                        if (DialogResult.OK == MessageBox.Show(sMsg, Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
                        {
                            switch (m_sType)
                            {
                            case "Int16":
                            {
                                int nVal = (int)m_dNom;
                                Value = nVal;
                            } break;

                            case "Int32":
                            {
                                int nVal = (int)m_dNom;
                                Value = nVal;
                            } break;

                            case "Double":
                            {
                                Value = m_dNom;
                            } break;
                            }

                            if (Change != null)
                            {
                                Change(this);
                            }
                            Refresh();
                        }
                    }
                }
            }
        }
示例#3
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (m_xScalar != null)
            {
                int nWidth = Width / 3;
                int nIndex = (int)(e.X / nWidth);
                m_nSelect = nIndex;
                if (nIndex == 0)
                {
                    string sMsg = string.Format("Set = {0:F}, {1:F}, Are you sure?", m_dNomX * m_dCalX, m_dNomY * m_dCalY);
                    if (DialogResult.OK == MessageBox.Show(sMsg, Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
                    {
                        m_xScalar.Set(m_dNomX, m_dNomY);
                        if (Change != null)
                        {
                            Change(this);
                        }
                        Refresh();
                    }
                }

                if (nIndex == 1)
                {
                    if (m_dCalX != 0)
                    {
                        frmInput fInput = new frmInput();
                        fInput.Value  = m_xScalar.X * m_dCalX;
                        fInput.Min    = m_dMinX;
                        fInput.Max    = m_dMaxX;
                        fInput.Format = m_sFormatX;
                        if (DialogResult.OK == fInput.ShowDialog(this))
                        {
                            m_xScalar.X = fInput.Value / m_dCalX;
                            if (Change != null)
                            {
                                Change(this);
                            }
                            Refresh();
                        }
                        fInput.Dispose();
                    }
                }
                if (nIndex == 2)
                {
                    if (m_dCalY != 0)
                    {
                        frmInput fInput = new frmInput();
                        fInput.Value  = m_xScalar.Y * m_dCalY;
                        fInput.Min    = m_dMinY;
                        fInput.Max    = m_dMaxY;
                        fInput.Format = m_sFormatY;
                        if (DialogResult.OK == fInput.ShowDialog(this))
                        {
                            m_xScalar.Y = fInput.Value / m_dCalY;
                            if (Change != null)
                            {
                                Change(this);
                            }
                            Refresh();
                        }
                        fInput.Dispose();
                    }
                }
            }
        }