Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            ModalDialog.SetParent(this.DrawingCanvas);

            drawArea             = new DrawingArea(this.DrawingCanvas);
            drawArea.Tool        = CurrentTool.Pencil;
            drawArea.StrokeColor = new SolidColorBrush(Colors.YellowGreen);
            drawArea.FillColor   = new SolidColorBrush(Colors.White);
            drawArea.StrokeWidth = 5;
            this.DataContext     = drawArea;
        }
Ejemplo n.º 2
0
 private void NewButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var handled = ModalDialog.ShowHandlerDialog();
         if (handled)
         {
             // ----
             drawArea.Clear();
             this.DrawingCanvas.Width  = int.Parse(ModalDialog.WidthTextBox.Text);
             this.DrawingCanvas.Height = int.Parse(ModalDialog.HeightTextBox.Text);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error while creating file", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }