Esempio n. 1
0
 private void ComplexBTN_Click(object sender, EventArgs e)
 {
     if (TreeSelectedLines.Count > 1)
     {
         InfoPanel.currentActionInfo.Text = "Объединение";
         TightUper.TightUp(TreeSelectedLines);
         TreeListControl.TreeSource.Refresh();
     }
     else
     {
         string            message = "Выделите 2 и более линий для объединения.";
         string            caption = "Действие невозможно.";
         MessageBoxButtons buttons = MessageBoxButtons.OK;
         DialogResult      result;
         result = MessageBox.Show(message, caption, buttons);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Обработчик клавиш-команд, шорткаты
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="keyData"></param>
        /// <returns></returns>
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            #region CLosing and MassDelete
            if (keyData == Keys.Escape)
            {
                return(true);
            }
            if (keyData == Keys.Delete)
            {
                if (TreeSelectedLines.Count > 0)
                {
                    foreach (var line in TreeSelectedLines)
                    {
                        TreeListControl.RemoveInfoLine(line);
                        _allLines.Remove(line);
                    }
                    drawingPanel.Refresh();
                    TreeListControl.TreeSource.Refresh();
                }
            }
            #endregion

            #region Manage ShortCuts
            //шорткаты
            if (keyData == Keys.P)
            {
                CURRENT_ACTION = Action.MakeParallelTo;
                InfoPanel.currentActionInfo.Text = "Параллельность к.";
            }

            if (keyData == Keys.U && TreeSelectedLines.Count > 1)
            {
                TightUper.TightUp(TreeSelectedLines);
                TreeListControl.TreeSource.Refresh();
            }

            if (keyData == Keys.D)
            {
                CURRENT_ACTION = Action.Draw;
                InfoPanel.currentActionInfo.Text = "Рисование.";
            }

            if (keyData == Keys.C)
            {
                CURRENT_ACTION = Action.Delete;
                InfoPanel.currentActionInfo.Text = "Удаление.";
            }

            if (keyData == Keys.S)
            {
                CURRENT_ACTION = Action.Select;
                InfoPanel.currentActionInfo.Text = "Выбор.";
            }

            if (keyData == Keys.T)
            {
                CURRENT_ACTION = Action.Transfer;
                InfoPanel.currentActionInfo.Text = "Перемещение.";
            }

            if (keyData == Keys.F)
            {
                CURRENT_ACTION = Action.Fix;
                InfoPanel.currentActionInfo.Text = "Фиксация";
            }

            if (keyData == Keys.Q)
            {
                CURRENT_ACTION = Action.AlignHorizontally;
                InfoPanel.currentActionInfo.Text = "Выровнять гор.";
            }
            if (keyData == Keys.W)
            {
                CURRENT_ACTION = Action.AlignVertically;
                InfoPanel.currentActionInfo.Text = "Выровнять верт.";
            }
            if (keyData == Keys.E)
            {
                CURRENT_ACTION = Action.MakeParallelTo;
                InfoPanel.currentActionInfo.Text = "Параллельность к.";
            }

            if (keyData == Keys.O)
            {
                CURRENT_ACTION = Action.MakeOrthogonal;
                InfoPanel.currentActionInfo.Text = "Ортогональность к.";

                string            message = "Линия которая будет повернута, затем относительно которой будет повернута.";
                string            caption = "Виберите линию.";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result;
                result = MessageBox.Show(message, caption, buttons);
            }

            if (keyData == Keys.A)
            {
                CURRENT_ACTION = Action.Angle;
                InfoPanel.currentActionInfo.Text = "Угол.";
            }

            if (keyData == Keys.N)
            {
                CURRENT_ACTION = Action.FixPoint;
                InfoPanel.currentActionInfo.Text = "Фиксация точки";
            }

            return(base.ProcessCmdKey(ref msg, keyData));

            #endregion
        }