Ejemplo n.º 1
0
        private void ChangeWindowParameters_btn_Click(object sender, EventArgs e)
        {
            String errorMsg = "";

            errorMsgs_richTextBox.Text = "";
            if (windowLength_numericUpDown.Value > pictureBox.Size.Height || windowWidth_numericUpDown.Value > pictureBox.Size.Width)
            {
                errorMsg += ("Заданы слишком большие размеры прямоугольной области. \nДлина должна быть меньше "
                             + pictureBox.Size.Height + ", а ширина меньше " + pictureBox.Size.Width + "\n");
            }
            if (windowTopLeftX_numericUpDown.Value + windowWidth_numericUpDown.Value >= pictureBox.Size.Width)
            {
                errorMsg += ("Прямоугольное окно не вписывается в область рисования по ширине\n");
            }
            if (windowTopLeftY_numericUpDown.Value + windowLength_numericUpDown.Value >= pictureBox.Size.Height)
            {
                errorMsg += ("Прямоугольное окно не вписывается в область рисования по длине\n");
            }
            if (errorMsg != "")
            {
                errorMsgs_richTextBox.SelectionColor = System.Drawing.Color.Red;
                errorMsgs_richTextBox.AppendText(errorMsg);
            }
            else
            {
                _presenter.SetClippingWindow(
                    windowTopLeftX_numericUpDown.Value, windowTopLeftY_numericUpDown.Value,
                    windowWidth_numericUpDown.Value, windowLength_numericUpDown.Value
                    );
                _presenter.DisplaySegments();
            }
        }
Ejemplo n.º 2
0
 public Form1()
 {
     InitializeComponent();
     windowTopLeftY_numericUpDown.Maximum = pictureBox.Size.Height;
     windowTopLeftX_numericUpDown.Maximum = pictureBox.Size.Width;
     windowWidth_numericUpDown.Maximum    = pictureBox.Size.Width;
     windowLength_numericUpDown.Maximum   = pictureBox.Size.Height;
     _presenter = new MainViewPresenter(this);
     _presenter.SetClippingWindow(
         windowTopLeftX_numericUpDown.Value, windowTopLeftY_numericUpDown.Value,
         windowWidth_numericUpDown.Value, windowLength_numericUpDown.Value
         );
     _presenter.DisplaySegments();
 }