void FormatOnClick(object sender, RoutedEventArgs e) { StylusToolDialog dlg = new StylusToolDialog() { Owner = this, Title = "Format selection" }; // stroke for the first selected stroke StrokeCollection strokes = inkcanv.GetSelectedStrokes(); if (strokes.Count > 0) { dlg.DrawingAttributes = strokes[0].DrawingAttributes; } else { dlg.DrawingAttributes = inkcanv.DefaultDrawingAttributes; } if ((bool)dlg.ShowDialog().GetValueOrDefault()) { foreach (Stroke strk in strokes) { strk.DrawingAttributes = dlg.DrawingAttributes; } } }
// Format Selection item: invoke StylusToolDialog. void FormatOnClick(object sender, RoutedEventArgs args) { StylusToolDialog dlg = new StylusToolDialog(); dlg.Owner = this; dlg.Title = "Format Selection"; // Try getting the DrawingAttributes of the first selected stroke. StrokeCollection strokes = inkcanv.GetSelectedStrokes(); if (strokes.Count > 0) { dlg.DrawingAttributes = strokes[0].DrawingAttributes; } else { dlg.DrawingAttributes = inkcanv.DefaultDrawingAttributes; } if ((bool)dlg.ShowDialog().GetValueOrDefault()) { // Set the DrawingAttributes of all the selected strokes. foreach (Stroke strk in strokes) { strk.DrawingAttributes = dlg.DrawingAttributes; } } }
// StylusToolDialog�� ���� DrawingAttributes property�� ����Ѵ�. void StylusToolOnClick(object sender, RoutedEventArgs args) { StylusToolDialog dlg = new StylusToolDialog(); dlg.Owner = this; dlg.DrawingAttributes = inkcanv.DefaultDrawingAttributes; if ((bool)dlg.ShowDialog().GetValueOrDefault()) { inkcanv.DefaultDrawingAttributes = dlg.DrawingAttributes; } }
// Display StylusToolDialog and use DrawingAttributes property. void StylusToolOnClick(object sender, RoutedEventArgs args) { StylusToolDialog dlg = new StylusToolDialog(); dlg.Owner = this; dlg.DrawingAttributes = inkcanv.DefaultDrawingAttributes; if ((bool)dlg.ShowDialog().GetValueOrDefault()) { inkcanv.DefaultDrawingAttributes = dlg.DrawingAttributes; } }
// Format Selection item: invoke StylusToolDialog. void FormatOnClick(object sender, RoutedEventArgs args) { StylusToolDialog dlg = new StylusToolDialog(); dlg.Owner = this; dlg.Title = "Format Selection"; // Try getting the DrawingAttributes of the first selected stroke. StrokeCollection strokes = inkcanv.GetSelectedStrokes(); if (strokes.Count > 0) dlg.DrawingAttributes = strokes[0].DrawingAttributes; else dlg.DrawingAttributes = inkcanv.DefaultDrawingAttributes; if ((bool)dlg.ShowDialog().GetValueOrDefault()) { // Set the DrawingAttributes of all the selected strokes. foreach (Stroke strk in strokes) strk.DrawingAttributes = dlg.DrawingAttributes; } }