Пример #1
0
        /// <summary>
        /// Overridden to allow a read-only <see cref="T:Microsoft.VisualStudio.Modeling.Diagrams.TextField"/> to be added
        /// to the collection of <see cref="T:Microsoft.VisualStudio.Modeling.Diagrams.ShapeField"/> objects.
        /// </summary>
        /// <param name="shapeFields">A list of <see cref="T:Microsoft.VisualStudio.Modeling.Diagrams.ShapeField"/> objects
        /// which belong to the current shape.</param>
        protected override void InitializeShapeFields(IList <ShapeField> shapeFields)
        {
            base.InitializeShapeFields(shapeFields);
            // Removes the text field from the shape field list.
            shapeFields.RemoveAt(1);
            //
            BarkerEntityTextField textField = new BarkerEntityTextField("BarkerEntityNameDecorator");

            textField.DefaultText      = BarkerERShapeDomainModel.SingletonResourceManager.GetString("BarkerEntityShapeBarkerEntityNameDecoratorDefaultText");
            textField.DefaultFocusable = true;
            textField.DefaultAutoSize  = true;
            textField.AnchoringBehavior.MinimumHeightInLines     = 1;
            textField.AnchoringBehavior.MinimumWidthInCharacters = 1;

            // Header measure can be off by a small amount. This is harmless for display
            // unless the text is modified (clipped, wrapped, ellipsis, etc.)
            StringFormat headerFormat = new StringFormat(StringFormatFlags.NoClip | StringFormatFlags.NoWrap);

            headerFormat.Alignment        = StringAlignment.Center;
            headerFormat.LineAlignment    = StringAlignment.Center;
            headerFormat.Trimming         = StringTrimming.None;
            textField.DefaultStringFormat = headerFormat;
            textField.DefaultFontId       = new StyleSetResourceId(string.Empty, "ShapeTextBold10");
            shapeFields.Add(textField);
        }
Пример #2
0
        /// <summary>
        /// Overridden to allow a read-only <see cref="T:Microsoft.VisualStudio.Modeling.Diagrams.TextField"/> to be added
        /// to the collection of <see cref="T:Microsoft.VisualStudio.Modeling.Diagrams.ShapeField"/> objects.
        /// </summary>
        /// <param name="shapeFields">A list of <see cref="T:Microsoft.VisualStudio.Modeling.Diagrams.ShapeField"/> objects
        /// which belong to the current shape.</param>
        protected override void InitializeShapeFields(IList <ShapeField> shapeFields)
        {
            base.InitializeShapeFields(shapeFields);
            // Removes the text field from the shape field list.
            shapeFields.RemoveAt(1);
            //
            BarkerEntityTextField textField = new BarkerEntityTextField("BarkerEntityNameDecorator");

            textField.DefaultText      = BarkerERShapeDomainModel.SingletonResourceManager.GetString("BarkerEntityShapeBarkerEntityNameDecoratorDefaultText");
            textField.DefaultFocusable = true;
            textField.DefaultAutoSize  = true;
            textField.AnchoringBehavior.MinimumHeightInLines     = 1;
            textField.AnchoringBehavior.MinimumWidthInCharacters = 1;
            textField.DefaultFontId = new StyleSetResourceId(string.Empty, "ShapeTextBold10");
            shapeFields.Add(textField);
        }