コード例 #1
0
        public void OnPrinterSettingChange(SPrinterSetting ss)
        {
            SZSetting zseting = ss.ZSetting;

//			this.numericUpDownMesureXCoor.Value = new decimal( UIPreference.ToDisplayLength(m_CurrentUnit,zseting.fMesureXCoor));
//			this.numericUpDown7.Value = new decimal( UIPreference.ToDisplayLength(m_CurrentUnit,zseting.fMesureYCoor));
            this.zAixsSetting1.OnPrinterSettingChange(ss);
        }
コード例 #2
0
        public void OnPrinterSettingChange(SPrinterSetting ss)
        {
            try
            {
                m_PrinterSetting = ss;
                SZSetting zseting = ss.ZSetting;
                if (bLoaded && bAutoMeasure)
                {
                    ByhxZMoveParam param;
                    if (ScorpionCoreInterface.GetByhxZMoveParam(out param))
                    {
                        float zMaxPos1 = ss.ZSetting.fMesureMaxLen;
                        if (zMaxPos1 <= 0)
                        {
                            MessageBox.Show(ResString.GetResString("StrMesureResultError"), ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        float fZSpace    = ss.ZSetting.fHeadToPaper;
                        float paperThick = ss.sExtensionSetting.zMaxLength - zMaxPos1;//
                        if (paperThick >= 0)
                        {
                            ss.sBaseSetting.fPaperThick = paperThick; //同步参数到设置窗口
                        }
                        else
                        {
                            if (Math.Abs(paperThick) < 0.001f)
                            {
                                ss.sBaseSetting.fPaperThick = 0;
                            }
                            else
                            if (!SPrinterProperty.IsYUEDA())
                            {
                                MessageBox.Show(ResString.GetResString("StrZMaxTooShort"), ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        ss.sBaseSetting.fZSpace = fZSpace; //同步参数到设置窗口
                    }
                    //更新测高结果
                    //numericUpDownZMax.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureMaxLen);
                    //numericUpDownSensorPosZ.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fSensorPosZ);

                    bAutoMeasure = false;
                    SetPrinterStatusChanged(CoreInterface.GetBoardStatus()); //参数更新后触发回原点提示
                }
                else
                {
                    numericUpDownZspace.Value       = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fHeadToPaper);
                    numericUpDownZspeed.Value       = (decimal)zseting.fMeasureSpeedZ;
                    numericUpDownMesureHeight.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureHeight);
                    //numericUpDownZMax.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureMaxLen);
                    //numericUpDownMesureXCoor.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureXCoor);
                    //numericUpDownSensorPosZ.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fSensorPosZ);
                    //numericUpDown7.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureYCoor);
                    numericUpDown8.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.reserve1);

                    decimal x = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureXCoor);
                    if (x > numericUpDownMesureXCoor.Maximum || x < numericUpDownMesureXCoor.Minimum)
                    {
                        numericUpDownMesureXCoor.Value = numericUpDownMesureXCoor.Minimum;
                    }
                    else
                    {
                        numericUpDownMesureXCoor.Value = x;
                    }

                    decimal y = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureYCoor);
                    if (y > numericUpDown7.Maximum || y < numericUpDown7.Minimum)
                    {
                        numericUpDown7.Value = numericUpDown7.Minimum;
                    }
                    else
                    {
                        numericUpDown7.Value = y;
                    }
                }

                if ((decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureMaxLen) > numericUpDownZMax.Maximum || (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureMaxLen) < numericUpDownZMax.Minimum)
                {
                    numericUpDownZMax.Value = 0;
                }
                else
                {
                    numericUpDownZMax.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureMaxLen);
                }
                if ((decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fSensorPosZ) > numericUpDownSensorPosZ.Maximum || (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fSensorPosZ) < numericUpDownSensorPosZ.Minimum)
                {
                    numericUpDownSensorPosZ.Value = 0;
                }
                else
                {
                    numericUpDownSensorPosZ.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fSensorPosZ);
                }

                UIPreference.SetValueAndClampWithMinMax(m_NumericUpDownThickness, m_CurrentUnit, ss.sBaseSetting.fPaperThick);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }