private void paintLines(IDN n) { SolidColorBrush brush = new SolidColorBrush(colorPicker.SelectedColor.Value); int thickness; Int32.TryParse(comboBox.SelectionBoxItem.ToString(), out thickness); for (int i = 1; i < n.pList.Count; i++) { Line line = new Line(); line.Stroke = brush; line.StrokeThickness = thickness; if (n.pList.Count == 1) { break; } line.X1 = n.pList.ElementAt(i - 1).X; line.X2 = n.pList.ElementAt(i).X; line.Y1 = n.pList.ElementAt(i - 1).Y; line.Y2 = n.pList.ElementAt(i).Y; Cnv.Children.Add(line); } }
private void createNode(XmlTextWriter writer, IDN idn, double scaleX, double scaleY) { writer.WriteStartElement("LineSegment"); foreach (var v in idn.pList) { writer.WriteStartElement("X"); writer.WriteString(Math.Round((v.X * scaleX), 2).ToString()); writer.WriteEndElement(); } foreach (var v in idn.pList) { writer.WriteStartElement("Y"); writer.WriteString(Math.Round((v.Y * scaleY), 2).ToString()); writer.WriteEndElement(); } writer.WriteEndElement(); }
private void image_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { System.Windows.Point p = e.GetPosition(this.Cnv); p.X = Math.Round(p.X); p.Y = Math.Round(p.Y); IDN neutrophil = new IDN(); neutrophil.scaleX = (image.Source.Width / image.Width); neutrophil.scaleY = (image.Source.Height / image.Height); neutrophil.timeChannel = tcList.ElementAt(tcIndex).fileName; neutrophil.name = "LineSegment" + lineSegmentIndex.ToString(); neutrophil.timeChannel = image.Source.ToString().Substring(image.Source.ToString().LastIndexOf('/') + 1); neutrophil.timeChannel = neutrophil.timeChannel.Substring(0, neutrophil.timeChannel.Length - 4); Neutrophil = neutrophil; nList.Add(Neutrophil); Neutrophil.addPointToList(p); lineSegmentIndex++; var v = Neutrophil; listBox1.Items.Add(v); }