public EdgePartProperties(EdgePart edgePart)
        {
            InitializeComponent();

            Statics.AddImageToButtonWithText(AddEdgeLabelButton, "Tango Icons\\list-add.png");
            Statics.AddImageToButtonWithText(CloseButton, "checkmark48.png");
            Statics.AddImageToButtonWithText(RemoveEdgeLabelButton, "Tango Icons\\edit-delete.png");
            Statics.AddImageToButtonWithText(ApplyChangesButton, "Tango Icons\\view-refresh.png");

            this.edgePart = edgePart;

            PositionSlider.Value  = 50;
            PositionSlider1.Value = 50;

            groupBox1.IsEnabled = false;

            TextTextBox.Focus();
            showAll();
        }
        public TextBlockVisual3DProperties()
        {
            InitializeComponent();

            // When setting multiple properties of TextBlockVisual3D
            // it is highly recommended to use BeginInit and EndInit.
            // This way the settings are applied only once and this can improve performance.
            TextBlockVisual1.BeginInit();


            TextTextBox.Text =
                @"TextBlockVisual3D
provides the easiest way to show
3D text and has a lot of options to
control text and border style.";


            AddComboBox(OptionsGrid, TextBlockVisual3D.PositionProperty, 0, new string[] { "0 0 0", "-50 0 0", "0 50 0", "50 0 0" },
                        "Position property defines the position of the Text. See also PositionType to see what point on the 3D model the Position property represents.",
                        2, null, OnPositionChanged);

            var textBlock = AddTextBlock(OptionsGrid, "Selected position is marked with a red cross.");

            textBlock.FontWeight = FontWeights.Normal;
            textBlock.Foreground = Brushes.Red;
            textBlock.Margin     = new Thickness(0, 0, 0, 10);

            AddComboBox(OptionsGrid, TextBlockVisual3D.PositionTypeProperty, 0, new string[] { "Center", "Left", "Right", "Top", "Bottom", "TopLeft", "BottomLeft", "TopRight", "BottomRight" },
                        "PositionType specifies what point on the 3D model the Position property represents.");

            AddComboBox(OptionsGrid, TextBlockVisual3D.TextDirectionProperty, 0, new string[] { "1 0 0", "0 0 1", "0 1 0", "1 0 1" },
                        "TextDirection property is a Vector3D that defines the direction in 3D space in which the text is drawn. Note that TextDirection and UpDirection must not be the same.");

            AddComboBox(OptionsGrid, TextBlockVisual3D.UpDirectionProperty, 0, new string[] { "0 1 0", "0 0 -1", "1 0 0" },
                        "UpDirection property is a Vector3D that defines the text up direction in 3D space. Note that TextDirection and UpDirection must not be the same.");


            AddComboBox(OptionsGrid, TextBlockVisual3D.SizeProperty, 0, new string[] { "Size.Empty", "0 20", "0 40", "100 0", "200 0", "200 40", "200 100" },
                        "Size property defines the size of 3D model that shows the text.\nNote that it is possible to define only Width or only Height or even set Size to Empty.\nIn case when one Size property is not defined, then it is calculated from the other Size property and the measured text size or BorderSize property. When Size is Empty, then both Width and Height are get from measured text size or BorderSize property.\nThis way it is easy to specify only the desired text height in 3D space and the TextBlockVisual3D will automatically calculate the width of the model.",
                        8,
                        resolveItemText : delegate(string itemText)
            {
                if (itemText == "Size.Empty")
                {
                    return((object)Size.Empty);
                }

                return(null);
            });


            AddComboBox(OptionsGrid, TextBlockVisual3D.FontSizeProperty, 0, new string[] { "10", "12", "16", "20", "30" },
                        "FontSize defines the size of the text in TextBlock element.", 8);

            AddComboBox(OptionsGrid, TextBlockVisual3D.ForegroundProperty, 1, new string[] { "Black", "Green", "Yellow", "White" },
                        "Foreground defines the foreground brush of the text in TextBlock element.");

            //AddComboBox(OptionsGrid, TextBlockVisual3D.FontWeightProperty, 1, new string[] { "Normal", "Bold", "Black" },
            //    "FontWeight defines the weight of the text in TextBlock element.");

            //AddComboBox(OptionsGrid, TextBlockVisual3D.FontFamilyProperty, 1, new string[] { "Arial", "Consolas", "Times New Roman" },
            //    "FontFamily defines the font family of the text in TextBlock element.");


            AddComboBox(OptionsGrid, TextBlockVisual3D.BackgroundProperty, 3, new string[] { "null", "Transparent", "White", "LightGray", "LightBlue", "Yellow" },
                        "Background defines the Brush that fill the background of the Border element.\nNote that when Background is null or set to Transparent brush, you need to define the TextBlockVisual3D object after all other solid 3D models. If this is not done that 3D models that are defined after the TextBlockVisual3D object will not be visible through the transparent text background (see Transparency problem in Utilities section for more info).");

            AddComboBox(OptionsGrid, TextBlockVisual3D.BorderBrushProperty, 6, new string[] { "null", "Transparent", "White", "LightGray", "Black", "LightBlue", "Yellow" },
                        "BorderBrush defines the Brush that will be used to show the border around the text.", 8);

            AddComboBox(OptionsGrid, TextBlockVisual3D.BorderThicknessProperty, 1, new string[] { "0", "1", "2", "3", "4", "5" },
                        "BorderThickness defines the thickness of the border around the text.");

            AddComboBox(OptionsGrid, TextBlockVisual3D.TextPaddingProperty, 4, new string[] { "0", "1", "2", "5", "3 0", "5 3", "5 4 3 2" },
                        "Thickness that specifies the padding of the TextBlock element inside the Border element.");


            //AddComboBox(OptionsGrid, TextBlockVisual3D.BorderSizeProperty, 0, new string[] { "Size.Empty", "0 20", "0 40", "100 0", "200 0", "200 40", "200 100" },
            //    "BorderSize can be set to define the 2D size of the Border element. By default BorderSize is set to Size.Empty. This automatically scales the Border element to show the whole TextBlock element. But when you want to trim the text, you need to set the BorderSize to a valid size value.",
            //    8,
            //    resolveItemText: delegate (string itemText)
            //    {
            //        if (itemText == "Size.Empty")
            //            return (object)Size.Empty;

            //        return null;
            //    });


            AddComboBox(OptionsGrid, TextBlockVisual3D.IsTwoSidedTextProperty, 0, new string[] { "true", "false" },
                        "IsTwoSidedText property specifies if the plane 3D models shows text on both front and back sides.", 8);

            AddComboBox(OptionsGrid, TextBlockVisual3D.IsBackSidedTextFlippedProperty, 0, new string[] { "true", "false" },
                        "IsBackSidedTextFlipped property specifies if the text on the back side is horizontally flipped so that it appears correct when viewing from the back side.");


            // When the TextBlockVisual3D is used with DXEngine,
            // it is highly recommended to set the desired size of the bitmap that is used to show the rendered TextBlock:

            //TextBlockVisual1.RenderBitmapSize = new Size(128, 64);
            //TextBlockVisual1.RenderBitmapSize = new Size(512, 256);


            TextBlockVisual1.EndInit();


            var textBlock2 = AddTextBlock(OptionsGrid, "Additional TextBlockVisual3D properties:");

            textBlock2.Margin = new Thickness(0, 10, 0, 0);

            var textBlock3 = AddTextBlock(OptionsGrid, "FontWeight, FontFamily, BorderSize, TextWrapping, TextTrimming, TextHorizontalAlignment, TextVerticalAlignment, TextAlignment.");

            textBlock3.FontWeight   = FontWeights.Normal;
            textBlock3.TextWrapping = TextWrapping.Wrap;
            textBlock3.MaxWidth     = 300;


            this.Loaded += delegate(object sender, RoutedEventArgs args)
            {
                TextTextBox.Focus();
                TextTextBox.CaretIndex = TextTextBox.Text.Length;
            };
        }
 private void TextEditDialogView_OnLoaded(object sender, RoutedEventArgs e)
 {
     TextTextBox.Focus();
 }
Ejemplo n.º 4
0
        //needs work with nested nodes
        //also super slow lol
        private void UpdateSyntaxHighlighting()
        {
            if (IsXml)
            {
                string          nodes            = "<.+?>|\t<.+?>";
                MatchCollection nodeMatches      = Regex.Matches(TextTextBox.Text, nodes);
                string          comments         = "<!--.+?-->";
                MatchCollection commentMatches   = Regex.Matches(TextTextBox.Text, comments);
                string          attributeNames   = " .+?=\"";
                MatchCollection attributeMatches = Regex.Matches(TextTextBox.Text, attributeNames);
                string          strings          = "\".+?\"";
                MatchCollection stringMatches    = Regex.Matches(TextTextBox.Text, strings);

                int   originalIndex  = TextTextBox.SelectionStart;
                int   originalLength = TextTextBox.SelectionLength;
                Color originalColor  = Color.Black;
                MainMenuStrip.Focus();
                TextTextBox.SelectionStart  = 0;
                TextTextBox.SelectionLength = TextTextBox.Text.Length;
                TextTextBox.SelectionColor  = originalColor;

                if (nodeMatches != null)
                {
                    foreach (Match m in nodeMatches)
                    {
                        TextTextBox.SelectionStart  = m.Index;
                        TextTextBox.SelectionLength = m.Length;
                        TextTextBox.SelectionColor  = NodeColor;
                    }
                }

                if (attributeMatches != null)
                {
                    foreach (Match m in attributeMatches)
                    {
                        TextTextBox.SelectionStart  = m.Index;
                        TextTextBox.SelectionLength = m.Length;
                        TextTextBox.SelectionColor  = AttributeColor;
                    }
                }

                if (stringMatches != null)
                {
                    foreach (Match m in stringMatches)
                    {
                        TextTextBox.SelectionStart  = m.Index;
                        TextTextBox.SelectionLength = m.Length;
                        TextTextBox.SelectionColor  = StringColor;
                    }
                }

                if (commentMatches != null)
                {
                    foreach (Match m in commentMatches)
                    {
                        TextTextBox.SelectionStart  = m.Index;
                        TextTextBox.SelectionLength = m.Length;
                        TextTextBox.SelectionColor  = CommentColor;
                    }
                }


                TextTextBox.SelectionStart  = originalIndex;
                TextTextBox.SelectionLength = originalLength;
                TextTextBox.SelectionColor  = originalColor;
                TextTextBox.Focus();
            }
        }
Ejemplo n.º 5
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     TextTextBox.Focus();
 }