Exemple #1
0
        private void NewCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            D3DViewer aViwer = new D3DViewer();

            Grid g = new Grid();

            Map.Add(g, aViwer);

            ImageBrush anImage = new ImageBrush(aViwer.Image);

            //anImage.RelativeTransform = new ScaleTransform (1.0, -1.0, 0.5, 0.5);

            g.Background = anImage;
            g.MouseMove += new MouseEventHandler(g_MouseMove);
            g.MouseDown += new MouseButtonEventHandler(g_MouseDown);
            g.MouseUp   += new MouseButtonEventHandler(g_MouseUp);

            g.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;


            TabItem aNewTab = new TabItem();

            aNewTab.Content = g;

            aNewTab.HorizontalAlignment        = System.Windows.HorizontalAlignment.Stretch;
            aNewTab.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch;
            aNewTab.VerticalContentAlignment   = System.Windows.VerticalAlignment.Stretch;

            g.SizeChanged += new SizeChangedEventHandler(g_SizeChanged);

            aNewTab.IsSelected = true;
            aNewTab.Header     = "Document " + myDocumentCounter.ToString();
            myDocumentCounter++;

            ViewPanel.Items.Add(aNewTab);

            ViewPanel.Focus();

            // update XAML property
            RaisePropertyChanged("IsDocumentOpen");
        }
Exemple #2
0
    private void NewCommand_Executed (object sender, ExecutedRoutedEventArgs e)
    {
      D3DViewer aViwer = new D3DViewer ();

      Grid g = new Grid ();

      Map.Add (g, aViwer);

      ImageBrush anImage = new ImageBrush (aViwer.Image);
      
      anImage.RelativeTransform = new ScaleTransform (1.0, -1.0, 0.5, 0.5);

      g.Background = anImage;
      g.MouseMove += new MouseEventHandler (g_MouseMove);
      g.MouseDown += new MouseButtonEventHandler (g_MouseDown);
      g.MouseUp += new MouseButtonEventHandler (g_MouseUp);

      g.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;


      TabItem aNewTab = new TabItem ();
      aNewTab.Content = g;

      aNewTab.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
      aNewTab.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch;
      aNewTab.VerticalContentAlignment = System.Windows.VerticalAlignment.Stretch;

      g.SizeChanged += new SizeChangedEventHandler (g_SizeChanged);

      aNewTab.IsSelected = true;
      aNewTab.Header = "Document " + myDocumentCounter.ToString ();
      myDocumentCounter++;

      ViewPanel.Items.Add (aNewTab);

      ViewPanel.Focus ();

      // update XAML property
      RaisePropertyChanged ("IsDocumentOpen");
    }