/// <summary> /// Начало выполнения какого либо {ВЫБРАННОГО} действия /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void drawingPanel_MouseDown(object sender, MouseEventArgs e) { InfoPanel.toDefault(); if (e.Button == MouseButtons.Left) //В соотвествии с текущим действием включается функция { if (CURRENT_ACTION == Action.Draw) { Line.StartDrawingLine(e); } if (CURRENT_ACTION == Action.Transfer) { Line.TransferLine(e); } if (CURRENT_ACTION == Action.Select) { Line.SelectLine(e); } if (CURRENT_ACTION == Action.Delete) { Line.DeleteLine(e); } if (CURRENT_ACTION == Action.Fix) { Line.FixLine(e); } if (CURRENT_ACTION == Action.AlignHorizontally) { Line.AlignHorizontally(e); } if (CURRENT_ACTION == Action.AlignVertically) { Line.AlignVertivally(e); } if (CURRENT_ACTION == Action.MakeOrthogonal) { Line.MakePerpendicularLine(e.Location); } if (CURRENT_ACTION == Action.MakeParallelTo) { Line.MakeParallelLine(e.Location); } if (CURRENT_ACTION == Action.Angle) { Line.ShowAngleBetween(e.Location); } if (CURRENT_ACTION == Action.FixPoint) { Line.FixPointOnLine(e.Location); } } drawingPanel.Refresh(); }
/// <summary> /// Создание компонентов формы и их инициализация /// </summary> public Form1() { MyLogger.LogIt("Form's initialized", MyLogger.Importance.SYSTEM); InitializeComponent(); TOP_BORDER = drawingPanel.Height; BOTTOM_BORDER = drawingPanel.Bottom; LEFT_BORDER = drawingPanel.Left; RIGHT_BORDER = drawingPanel.Right; TreeListControl.Enabled = true; //Вывод списка линий в ГУИ TreeListControl.TreeSource = listTree; InfoPanel.lineLenghtInfo = lineLengthFLD; //Вся инфа на ГУИ панелях назначается тут, инициализируется ниже InfoPanel.startPointInfo = startPointUI; InfoPanel.endPointInfo = endPointUI; InfoPanel.currentActionInfo = currentActionUI; InfoPanel.INFOPANEL_INIT(); g = drawingPanel.CreateGraphics(); //Создаем графическое полотно на панели this.DoubleBuffered = true; //двойная буферизация что бы не мелькало при рисованиии }