private void style1_Checked(object sender, RoutedEventArgs e) { dashes = new DoubleCollection(); dashes.Clear(); if (adlayer != null) { shape.ChangeDash(dashes); } }
public static void StringToDashArray(string str, DoubleCollection array) { var nfi = new NumberFormatInfo(); nfi.NumberDecimalSeparator = "."; array.Clear(); str = str.Trim(); if (!String.IsNullOrEmpty(str)) { var split = str.Split(',', ' '); foreach (var s in split) { double dbl; if (Double.TryParse(s.Trim(), NumberStyles.Any, nfi, out dbl)) { array.Add(dbl); } } } }
// Thay đổi kiể Border private void cbBorderStyle_SelectionChanged(object sender, SelectionChangedEventArgs e) { Dashes.Clear(); switch (cbBorderStyle.SelectedIndex) { case 0: break; case 1: Dashes.Add(0.5); break; case 2: Dashes.Add(4); break; } // Cập nhật brush nếu đang chọn shape if (isSelectShape) { shape.StrokeType = new DoubleCollection(Dashes); shape.updateShapeStyle(PaintCanvas.Children); } }