Exemple #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);
            //
            TableTextField textField = new TableTextField("TableNameDecorator");

            textField.DefaultText      = RelationalShapeDomainModel.SingletonResourceManager.GetString("TableShapeTableNameDecoratorDefaultText");
            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);
        }
        /// <summary>
        /// Updates the size of the <see cref="T:ORMSolutions.ORMArchitect.Views.RelationalView.TableShape"/> and makes sure the Name field is adjusted correctly
        /// </summary>
        /// <param name="newSize"></param>
        public void UpdateSize(SizeD newSize)
        {
            this.Size = newSize;

            // Set the minimum width of the text field to be just smallter than the table so that the maximum amount of the table name will be dislplayed
            // Currently there is a bug in the autosize that will not show the full name of certain tables, example: SportPlay
            TableTextField nameField = this.NameField;

            if (nameField != null)
            {
                // The .05 adjustment here accounts for the .015 left and right margins applied in
                // the CompartmentShape.AnchorAllCompartments and some padding
                nameField.AnchoringBehavior.MinimumWidth = newSize.Width - 0.05;
            }
        }
Exemple #3
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);
            //
            TableTextField textField = new TableTextField("TableNameDecorator");

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