Beispiel #1
0
        public TAMessageBox(string headerText, string messageText, bool okNeed, bool error)
        {
            InitializeComponent();

            this.Text = headerText;
            this.MessageTextBox.Text = messageText;

            if (!okNeed)
            {
                OkButton.Hide();
            }
            if (error)
            {
                Style = MetroFramework.MetroColorStyle.Red;
                MessageTextBox.Style = MetroFramework.MetroColorStyle.Red;
            }

            Opacity = 0;
            Timer timer = new Timer();

            timer.Tick += new EventHandler((sender, e) =>
            {
                if ((Opacity += 0.1d) == 1)
                {
                    timer.Stop();
                }
            });
            timer.Interval = 1;
            timer.Start();
        }
Beispiel #2
0
        public Form1()
        {
            InitializeComponent();
            bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height);
            g   = Graphics.FromImage(bmp);
            pictureBox1.Image = bmp;

            TransformationButton.Enabled = false;
            DefinitionButton.Enabled     = false;
            ResultLabel.Hide();
            comboBox1.Hide();
            textBox1.Hide();
            textBox2.Hide();
            label1.Hide();
            label2.Hide();
            OkButton.Hide();
        }
Beispiel #3
0
        private void DefinitionButton_Click(object sender, EventArgs e)
        {
            if (current_primitive == "Point")
            {
                MessageBox.Show("Выберите другой примитив", "Ошибка",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            ResultLabel.Show();
            ResultLabel.Text = "Точка не выбрана";
            comboBox1.Hide();
            textBox1.Hide();
            textBox2.Hide();
            label1.Hide();
            label2.Hide();
            OkButton.Hide();
            mode = "define";
        }
Beispiel #4
0
        public void BlockView_Load(object sender, EventArgs e)
        {
            if (Mode == BlockViewMode.New)
            {
                Text          = "New Schedule Block";
                OkButton.Text = "Create";
            }

            if (Mode == BlockViewMode.Edit)
            {
                Text          = "Edit Schedule Block";
                OkButton.Text = "Edit";
            }

            if (Mode == BlockViewMode.Show)
            {
                Text = Core.GetName(View.UserID) + "'s Block";
                OkButton.Hide();
            }
        }
Beispiel #5
0
        private void DrawButton_Click(object sender, EventArgs e)
        {
            bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height);
            g   = Graphics.FromImage(bmp);
            pictureBox1.Image = bmp;
            Points.Clear();
            mode = "draw";
            TransformationButton.Enabled = false;
            DefinitionButton.Enabled     = false;

            ResultLabel.Hide();
            comboBox1.Hide();
            textBox1.Hide();
            textBox2.Hide();
            label1.Hide();
            label2.Hide();
            OkButton.Hide();

            GetPrimitive form = new GetPrimitive();

            form.Owner = this;
            form.ShowDialog();
        }
Beispiel #6
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox1.SelectedItem.ToString())
            {
            case "Смещение":
            {
                if (current_transformation == "find point" && Points.Count == 4)
                {
                    draw_point(Points[2].X, Points[2].Y, this.pictureBox1.BackColor);
                    draw_point(Points[3].X, Points[3].Y, this.pictureBox1.BackColor);
                    g.DrawLine(new Pen(this.pictureBox1.BackColor, 3), Points[2], Points[3]);
                    Points.Remove(Points[3]);
                    Points.Remove(Points[2]);
                    g.DrawLine(new Pen(Color.Black, 3), Points[0], Points[1]);
                    pictureBox1.Image = bmp;
                }
                current_transformation = "shift";
                OkButton.Show();
                textBox1.Show();
                textBox2.Show();
                label1.Show();
                label2.Show();
                label1.Text   = "Введите сдвиг по X: ";
                label2.Text   = "Введите сдвиг по Y: ";
                textBox1.Text = "0";
                textBox2.Text = "0";
                break;
            }

            case "Поворот примитива":
            {
                if (current_transformation == "find point" && Points.Count == 4)
                {
                    draw_point(Points[2].X, Points[2].Y, this.pictureBox1.BackColor);
                    draw_point(Points[3].X, Points[3].Y, this.pictureBox1.BackColor);
                    g.DrawLine(new Pen(this.pictureBox1.BackColor, 3), Points[2], Points[3]);
                    Points.Remove(Points[3]);
                    Points.Remove(Points[2]);
                    g.DrawLine(new Pen(Color.Black, 3), Points[0], Points[1]);
                    pictureBox1.Image = bmp;
                }
                current_transformation = "rotation";
                OkButton.Show();
                textBox1.Show();
                textBox2.Hide();
                label1.Show();
                label2.Hide();
                label1.Text   = "Введите угол поворота: ";
                textBox1.Text = "0";
                break;
            }

            case "Поворот ребра":
            {
                if (current_transformation == "find point" && Points.Count == 4)
                {
                    draw_point(Points[2].X, Points[2].Y, this.pictureBox1.BackColor);
                    draw_point(Points[3].X, Points[3].Y, this.pictureBox1.BackColor);
                    g.DrawLine(new Pen(this.pictureBox1.BackColor, 3), Points[2], Points[3]);
                    Points.Remove(Points[3]);
                    Points.Remove(Points[2]);
                    g.DrawLine(new Pen(Color.Black, 3), Points[0], Points[1]);
                    pictureBox1.Image = bmp;
                }
                if (current_primitive != "Edge")
                {
                    OkButton.Hide();
                    textBox1.Hide();
                    textBox2.Hide();
                    label1.Hide();
                    label2.Hide();
                    MessageBox.Show("Выбран неправильный примитив", "Ошибка",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                current_transformation = "edge rotation";
                OkButton.Show();
                textBox1.Hide();
                textBox2.Hide();
                label1.Hide();
                label2.Hide();
                break;
            }

            case "Масштабирование":
            {
                if (current_transformation == "find point" && Points.Count == 4)
                {
                    draw_point(Points[2].X, Points[2].Y, this.pictureBox1.BackColor);
                    draw_point(Points[3].X, Points[3].Y, this.pictureBox1.BackColor);
                    g.DrawLine(new Pen(this.pictureBox1.BackColor, 3), Points[2], Points[3]);
                    Points.Remove(Points[3]);
                    Points.Remove(Points[2]);
                    g.DrawLine(new Pen(Color.Black, 3), Points[0], Points[1]);
                    pictureBox1.Image = bmp;
                }
                current_transformation = "scale";
                OkButton.Show();
                textBox1.Show();
                textBox2.Show();
                label1.Show();
                label2.Show();
                label1.Text   = "Введите коэффициент по X: ";
                label2.Text   = "Введите коэффициент по Y: ";
                textBox1.Text = "0";
                textBox2.Text = "0";
                break;
            }

            case "Поиск точки пересечения":
            {
                if (current_primitive != "Edge")
                {
                    OkButton.Hide();
                    textBox1.Hide();
                    textBox2.Hide();
                    label1.Hide();
                    label2.Hide();
                    MessageBox.Show("Выбран неправильный примитив", "Ошибка",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                current_transformation = "find point";
                OkButton.Show();
                textBox1.Hide();
                textBox2.Hide();
                label1.Show();
                label2.Hide();
                label1.Text = "Нарисуйте второе ребро";
                break;
            }
            }
        }