コード例 #1
0
        public StatusBar(DynamicGeometry.DrawingHost drawingHost)
        {
            DrawingHost         = drawingHost;
            HorizontalAlignment = HorizontalAlignment.Stretch;
            VerticalAlignment   = VerticalAlignment.Bottom;

            border.MouseLeftButtonDown += border_MouseLeftButtonDown;
            Grid g = new Grid();
            //g.ShowGridLines = true;
            ColumnDefinition c1 = new ColumnDefinition();

            c1.Width = new GridLength(0.3, GridUnitType.Star);

            ColumnDefinition c2 = new ColumnDefinition();

            c2.Width = new GridLength(0.2, GridUnitType.Star);

            ColumnDefinition c3 = new ColumnDefinition();

            c3.Width = new GridLength(0.3, GridUnitType.Star);

            ColumnDefinition c4 = new ColumnDefinition();

            c4.Width = new GridLength(0.2, GridUnitType.Star);

            ColumnDefinition c5 = new ColumnDefinition();

            c5.Width = new GridLength(50, GridUnitType.Pixel);

            ColumnDefinition c6 = new ColumnDefinition();

            c6.Width = new GridLength(50, GridUnitType.Pixel);

            ColumnDefinition c7 = new ColumnDefinition();

            c7.Width = new GridLength(50, GridUnitType.Pixel);

            ColumnDefinition c8 = new ColumnDefinition();

            c8.Width = new GridLength(50, GridUnitType.Pixel);
            ColumnDefinition c9 = new ColumnDefinition();

            c8.Width = new GridLength(50, GridUnitType.Pixel);

            g.ColumnDefinitions.Add(c1); // Cột chứa Status của phần mềm
            g.ColumnDefinitions.Add(c2); // Cột chứa thông tin khi Mouse Over trên Drawing
            g.ColumnDefinitions.Add(c3);
            g.ColumnDefinitions.Add(c4);
            g.ColumnDefinitions.Add(c5);
            g.ColumnDefinitions.Add(c6);
            g.ColumnDefinitions.Add(c7);
            g.ColumnDefinitions.Add(c8);

            statusText = new NotifycationLabel();
            Grid.SetColumn(statusText, 0);
            g.Children.Add(statusText);

            ProgressBar = new ProgressBar();
            Grid.SetColumn(ProgressBar, 1);
            ProgressBar.Maximum             = 100;
            ProgressBar.Minimum             = 0;
            ProgressBar.Width               = 100;
            ProgressBar.Margin              = new Thickness(5, 3, 5, 3);
            ProgressBar.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            g.Children.Add(ProgressBar);

            hintText = new NotifycationLabel();
            hintText.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            Grid.SetColumn(hintText, 2);
            g.Children.Add(hintText);

            coorText = new NotifycationLabel();
            coorText.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
            Grid.SetColumn(coorText, 3);
            g.Children.Add(coorText);

            scaleText = new NotifycationLabel()
            {
                Text = ""
            };
            Grid.SetColumn(scaleText, 4);
            g.Children.Add(scaleText);


            orthoButton = new StatusButton()
            {
                Content = "ORTHO"
            };
            orthoButton.ToolTip = (bool)orthoButton.IsChecked ? "Disable Ortho mode" : "Enable Ortho mode";
            Grid.SetColumn(orthoButton, 5);
            g.Children.Add(orthoButton);

            showGridButton = new StatusButton()
            {
                Content = "GRID"
            };
            showGridButton.ToolTip    = (bool)showGridButton.IsChecked ? "Hide Grid" : "Show Grid";
            showGridButton.Checked   += showGridButton_Checked;
            showGridButton.Unchecked += showGridButton_Unchecked;
            Grid.SetColumn(showGridButton, 6);
            g.Children.Add(showGridButton);

            snapButton = new StatusButton()
            {
                Content = "SNAP"
            };
            snapButton.ToolTip    = (bool)snapButton.IsChecked ? "Disable Snap mode" : "Enable Snap mode";
            snapButton.Checked   += snapButton_Checked;
            snapButton.Unchecked += snapButton_Unchecked;
            Grid.SetColumn(snapButton, 7);
            g.Children.Add(snapButton);

            unitComboBox = new ComboBox();
            unitComboBox.SelectionChanged += unitComboBox_SelectionChanged;
            ComboBoxItem mmUnit = new ComboBoxItem()
            {
                Content = "mm", ToolTip = "Set mm unit for drawing"
            };

            unitComboBox.Items.Add(mmUnit);
            ComboBoxItem cmUnit = new ComboBoxItem()
            {
                Content = "cm", ToolTip = "Set cm unit for drawing"
            };

            unitComboBox.Items.Add(cmUnit);
            ComboBoxItem mUnit = new ComboBoxItem()
            {
                Content = "m", ToolTip = "Set m unit for drawing"
            };

            unitComboBox.Items.Add(mUnit);
            unitComboBox.SelectedIndex = 1;
            Grid.SetColumn(unitComboBox, 8);
            g.Children.Add(unitComboBox);

            border.Child = g;
            this.Children.Add(border);

            TestProgressBar();
        }
コード例 #2
0
 public void RaiseDrawingChanged(DynamicGeometry.DrawingHost drawingHost)
 {
     this.DrawingHost = drawingHost;
 }