Example #1
0
        public ClosableTabItem()
        {
            closableTabHeader = new ClosableHeader();
            // Assign the usercontrol to the tab header
            this.Header = closableTabHeader;

            // Attach to the CloseableHeader events
            // (Mouse Enter/Leave, Button Click, and Label resize)
            closableTabHeader.button_close.MouseEnter +=
                new MouseEventHandler(button_close_MouseEnter);
            closableTabHeader.button_close.MouseLeave +=
                new MouseEventHandler(button_close_MouseLeave);
            closableTabHeader.button_close.Click +=
                new RoutedEventHandler(button_close_Click);
            closableTabHeader.label_TabTitle.SizeChanged +=
                new SizeChangedEventHandler(label_TabTitle_SizeChanged);
        }
Example #2
0
    /// <summary>
    /// Constructor
    /// </summary>
    public ClosableCanvasTabItem()
    {
        // Create the header UserControl
        ClosableHeader closableTabHeader = new ClosableHeader();

        // Assign user control to tab header
        this.Header = closableTabHeader;

        // Attach CloseableHeader button events
        closableTabHeader.tabClose.MouseEnter  += new MouseEventHandler(tabClose_MouseEnter);
        closableTabHeader.tabClose.MouseLeave  += new MouseEventHandler(tabClose_MouseLeave);
        closableTabHeader.tabClose.Click       += new RoutedEventHandler(tabClose_Click);
        closableTabHeader.tabTitle.SizeChanged += new SizeChangedEventHandler(tabTitle_SizeChanged);

        // Create Grid to contain two axes and drawing canvas
        Grid contentGrid = new Grid();

        contentGrid.Background = Brushes.WhiteSmoke;
        contentGrid.Margin     = new Thickness(0);
        this.Content           = contentGrid;

        double axisWidth = 65;

        // Create Grid object for x axis
        Grid xAxis = new Grid();

        xAxis.ClipToBounds        = true;
        xAxis.Background          = Brushes.WhiteSmoke;
        xAxis.VerticalAlignment   = VerticalAlignment.Bottom;
        xAxis.HorizontalAlignment = HorizontalAlignment.Stretch;
        xAxis.Margin = new Thickness(axisWidth, 0, 0, 10);
        xAxis.Height = axisWidth;
        contentGrid.Children.Add(xAxis);

        // Create Grid object for y axis
        Grid yAxis = new Grid();

        yAxis.ClipToBounds        = true;
        yAxis.Background          = Brushes.WhiteSmoke;
        yAxis.VerticalAlignment   = VerticalAlignment.Stretch;
        yAxis.HorizontalAlignment = HorizontalAlignment.Left;
        yAxis.Margin = new Thickness(0, 0, 0, axisWidth + 10);
        yAxis.Width  = axisWidth;
        contentGrid.Children.Add(yAxis);

        // Create SlopeCanvas object for drawing surface
        SlopeCanvas drawingCanvas = new SlopeCanvas();

        drawingCanvas.Background          = Brushes.White;
        drawingCanvas.VerticalAlignment   = VerticalAlignment.Stretch;
        drawingCanvas.HorizontalAlignment = HorizontalAlignment.Stretch;
        drawingCanvas.Margin = new Thickness(axisWidth, 0, 0, axisWidth + 10);
        drawingCanvas.InitializeCanvas();
        contentGrid.Children.Add(drawingCanvas);

        ProgressBar analysisProgress = new ProgressBar();

        analysisProgress.Height              = 10;
        analysisProgress.VerticalAlignment   = VerticalAlignment.Bottom;
        analysisProgress.HorizontalAlignment = HorizontalAlignment.Stretch;
        analysisProgress.Margin              = new Thickness(0, 0, 0, 0);
        analysisProgress.Visibility          = Visibility.Hidden;
        contentGrid.Children.Add(analysisProgress);

        Rectangle hideCanvasRect = new Rectangle();

        hideCanvasRect.Fill                = Brushes.White;
        hideCanvasRect.Opacity             = 0.5;
        hideCanvasRect.Stroke              = Brushes.White;
        hideCanvasRect.VerticalAlignment   = VerticalAlignment.Stretch;
        hideCanvasRect.HorizontalAlignment = HorizontalAlignment.Stretch;
        hideCanvasRect.Margin              = new Thickness(axisWidth, 0, 0, axisWidth + 10);
        hideCanvasRect.Visibility          = Visibility.Hidden;
        contentGrid.Children.Add(hideCanvasRect);
    }
    /// <summary>
    /// Constructor
    /// </summary>
    public ClosableCanvasTabItem()
    {
        // Create the header UserControl
        ClosableHeader closableTabHeader = new ClosableHeader();

        // Assign user control to tab header
        this.Header = closableTabHeader;

        // Attach CloseableHeader button events
        closableTabHeader.tabClose.MouseEnter += new MouseEventHandler( tabClose_MouseEnter );
        closableTabHeader.tabClose.MouseLeave += new MouseEventHandler( tabClose_MouseLeave );
        closableTabHeader.tabClose.Click += new RoutedEventHandler( tabClose_Click );
        closableTabHeader.tabTitle.SizeChanged += new SizeChangedEventHandler( tabTitle_SizeChanged );

        // Create Grid to contain two axes and drawing canvas
        Grid contentGrid = new Grid();
        contentGrid.Background = Brushes.WhiteSmoke;
        contentGrid.Margin = new Thickness( 0 );
        this.Content = contentGrid;

        double axisWidth = 65;

        // Create Grid object for x axis
        Grid xAxis = new Grid();
        xAxis.ClipToBounds = true;
        xAxis.Background = Brushes.WhiteSmoke;
        xAxis.VerticalAlignment = VerticalAlignment.Bottom;
        xAxis.HorizontalAlignment = HorizontalAlignment.Stretch;
        xAxis.Margin = new Thickness( axisWidth , 0 , 0 , 10 );
        xAxis.Height = axisWidth;
        contentGrid.Children.Add( xAxis );

        // Create Grid object for y axis
        Grid yAxis = new Grid();
        yAxis.ClipToBounds = true;
        yAxis.Background = Brushes.WhiteSmoke;
        yAxis.VerticalAlignment = VerticalAlignment.Stretch;
        yAxis.HorizontalAlignment = HorizontalAlignment.Left;
        yAxis.Margin = new Thickness( 0 , 0 , 0 , axisWidth + 10 );
        yAxis.Width = axisWidth;
        contentGrid.Children.Add( yAxis );

        // Create SlopeCanvas object for drawing surface
        SlopeCanvas drawingCanvas = new SlopeCanvas();
        drawingCanvas.Background = Brushes.White;
        drawingCanvas.VerticalAlignment = VerticalAlignment.Stretch;
        drawingCanvas.HorizontalAlignment = HorizontalAlignment.Stretch;
        drawingCanvas.Margin = new Thickness( axisWidth , 0 , 0 , axisWidth + 10 );
        drawingCanvas.InitializeCanvas();
        contentGrid.Children.Add( drawingCanvas );

        ProgressBar analysisProgress = new ProgressBar();
        analysisProgress.Height = 10;
        analysisProgress.VerticalAlignment = VerticalAlignment.Bottom;
        analysisProgress.HorizontalAlignment = HorizontalAlignment.Stretch;
        analysisProgress.Margin = new Thickness( 0 , 0 , 0 , 0 );
        analysisProgress.Visibility = Visibility.Hidden;
        contentGrid.Children.Add( analysisProgress );

        Rectangle hideCanvasRect = new Rectangle();
        hideCanvasRect.Fill = Brushes.White;
        hideCanvasRect.Opacity = 0.5;
        hideCanvasRect.Stroke = Brushes.White;
        hideCanvasRect.VerticalAlignment = VerticalAlignment.Stretch;
        hideCanvasRect.HorizontalAlignment = HorizontalAlignment.Stretch;
        hideCanvasRect.Margin = new Thickness( axisWidth , 0 , 0 , axisWidth + 10 );
        hideCanvasRect.Visibility = Visibility.Hidden;
        contentGrid.Children.Add( hideCanvasRect );
    }