private void toolStripButtonVerticalLine_Click(object sender, EventArgs e) { if (toolStripButtonVerticalLine.Checked) { if (MasterPane.CustomObjectsManager.IsBuildingObject) {// Already building. ((ToolStripButton)(sender)).Checked = false; return; } LineObject line = new LineObject("vertical line", LineObject.ModeEnum.VerticalLine); line.Pen = new Pen(DrawingColor); MasterPane.CustomObjectsManager.BuildDynamicObject(line); } else { MasterPane.CustomObjectsManager.StopBuildingDynamicObject(); } }