protected override void Save()
        {
            try
            {
                string input = _txtValue.Text;

                _scaleFactor = float.Parse(input);

                if (_scaleFactor < Utilities.MinScaleFactor || _scaleFactor > Utilities.MaxScaleFactor)
                {
                    MessageBoxes.ShowError(StringConstants.GetString(StringNames.SCALE_FACTOR_OUT_OF_RANGE));
                    return;
                }

                DialogResult = DialogResult.OK;
                Close();
            }
            catch
            {
                MessageBoxes.ShowError(StringConstants.GetString(StringNames.INVALID_SCALE_FACTOR));
            }
        }
예제 #2
0
        protected override void Save()
        {
            try
            {
                string input = _txtValue.Text;
                input = input.Trim();
                //				input = input.Replace(" ", "");
                input = input.Replace("(", "");
                input = input.Replace(")", "");
                input = input.Trim();

                string[] parts = input.Split(new char[] { ' ', ',', ';' });

                if (parts.GetLength(0) != 2)
                {
                    throw new Exception();
                }

                _offset = new Point(Int32.Parse(parts[0]), Int32.Parse(parts[1]));

                if (_offset.X < (0 - Utilities.MaxOffset) || _offset.X > Utilities.MaxOffset ||
                    _offset.Y < (0 - Utilities.MaxOffset) || _offset.Y > Utilities.MaxOffset)
                {
                    MessageBoxes.ShowError(StringConstants.GetString(StringNames.POINT_OUT_OF_RANGE));
                    return;
                }

                //				MessageBox.Show(String.Format("({0}, {1})", _offset.X, _offset.Y));

                DialogResult = DialogResult.OK;
                Close();
            }
            catch
            {
                MessageBoxes.ShowError(StringConstants.GetString(StringNames.INVALID_POINT_SYNTAX));
            }
        }