private void добавитьРозуToolStripMenuItem_Click(object sender, EventArgs e) { Rose rose = new Rose("Роза " + roses.Count.ToString(), 0, 0); roses.Add(rose); designerPanel.Invalidate(); }
private void designerPanel_MouseDown(object sender, MouseEventArgs e) { Rose rose = GetItemAt(e.X, e.Y); if (rose != null) { SelectedRose = rose; dragging = true; startDragPoint = e.Location; DrawDraggingShape(); } }
void OpenProject(string newFilename) { новыйToolStripMenuItem_Click(null, null); FileStream fs = new FileStream(newFilename, FileMode.Open); XmlTextReader xmlIn = new XmlTextReader(fs); xmlIn.WhitespaceHandling = WhitespaceHandling.None; xmlIn.MoveToContent(); if (xmlIn.Name != "RosesPlant") { throw new ArgumentException("Incorrect file format."); } string version = xmlIn.GetAttribute(0); do { if (!xmlIn.Read()) { throw new ArgumentException("Ошибочка"); } if ((xmlIn.NodeType == XmlNodeType.EndElement) && (xmlIn.Name == "RosesPlant")) { break; } if (xmlIn.NodeType == XmlNodeType.EndElement) { continue; } if (xmlIn.Name == "Rose") { Rose newItem = new Rose("", 0, 0); roses.Add(newItem); newItem.LoadFromFile(xmlIn); } } while (!xmlIn.EOF); xmlIn.Close(); fs.Close(); filename = newFilename; designerPanel.Invalidate(); }