Пример #1
0
 public override void OnClick(DiagramPointEventArgs e)
 {
     if (e != null && e.HitDiagramItem != null && e.HitDiagramItem.Field != null &&
         e.HitDiagramItem.Field is VDTitleImageField)
     {
         VDTitleImageField field       = e.HitDiagramItem.Field as VDTitleImageField;
         VDWidgetShape     parentShape = this.ParentShape as VDWidgetShape;
         if (parentShape != null)
         {
             parentShape.OnClickAdditionalTitleIcon(field.Index);
         }
     }
     base.OnClick(e);
 }
Пример #2
0
        /// <summary>
        /// Initialize the collection of shape fields associated with this shape type.
        /// </summary>
        protected override void InitializeShapeFields(global::System.Collections.Generic.IList <ShapeField> shapeFields)
        {
            base.InitializeShapeFields(shapeFields);

            ImageField titleIconField = new ImageField("WidgetTitleIcon");

            titleIconField.DefaultSelectable = false;
            titleIconField.DefaultFocusable  = false;
            //titleIconField.DefaultImage = ImageHelper.GetImage(MVCViewDesignerDomainModel.SingletonResourceManager.GetObject("GridLayoutToolToolboxBitmap"));
            titleIconField.AnchoringBehavior.SetTopAnchor(AnchoringBehavior.Edge.Top, 0.02);
            titleIconField.AnchoringBehavior.SetLeftAnchor(AnchoringBehavior.Edge.Left, 0.02);
            shapeFields.Add(titleIconField);

            TextField titleTextField = new TextField("WidgetTitleText");

            titleTextField.DefaultText      = string.Empty;
            titleTextField.DefaultFocusable = true;
            titleTextField.DefaultAutoSize  = true;
            titleTextField.AnchoringBehavior.MinimumHeightInLines     = 1;
            titleTextField.AnchoringBehavior.MinimumWidthInCharacters = 1;
            titleTextField.DefaultAccessibleState = global::System.Windows.Forms.AccessibleStates.Invisible;
            titleTextField.AnchoringBehavior.SetTopAnchor(AnchoringBehavior.Edge.Top, 0.02);
            titleTextField.AnchoringBehavior.SetLeftAnchor(titleIconField, AnchoringBehavior.Edge.Right, 0.02);
            titleTextField.DefaultFontId = new StyleSetResourceId(string.Empty, "ShapeTextBold9");
            shapeFields.Add(titleTextField);

            // more title icons
            ShapeField leftSibling = titleTextField;

            for (int i = 0; i < ADDITIONAL_TITLE_ICON_COUNT; i++)
            {
                VDTitleImageField moreTitleIconField = new VDTitleImageField("WidgetTitleIcon" + i, i);
                moreTitleIconField.DefaultSelectable = false;
                moreTitleIconField.DefaultFocusable  = false;
                moreTitleIconField.AnchoringBehavior.SetTopAnchor(AnchoringBehavior.Edge.Top, 0.02);
                moreTitleIconField.AnchoringBehavior.SetLeftAnchor(leftSibling, AnchoringBehavior.Edge.Right, 0.02);
                shapeFields.Add(moreTitleIconField);
                leftSibling = moreTitleIconField;
            }

            PinButtonField pinField = new PinButtonField("WidgetTitlePinIcon");

            pinField.AnchoringBehavior.SetTopAnchor(AnchoringBehavior.Edge.Top, 0.02);
            pinField.AnchoringBehavior.SetRightAnchor(AnchoringBehavior.Edge.Right, 0.02);
            pinField.DefaultSelectable = false;
            pinField.DefaultFocusable  = false;
            shapeFields.Add(pinField);
        }