Example #1
0
        protected override Size OnLayoutSize(ActivityDesignerLayoutEventArgs e)
        {
            Size size = base.OnLayoutSize(e);
            CompositeDesignerTheme designerTheme = e.DesignerTheme as CompositeDesignerTheme;

            if ((this.Expanded && (base.ActiveDesigner == this)) && (designerTheme != null))
            {
                if (this.HelpText.Length > 0)
                {
                    this.helpTextSize = ActivityDesignerPaint.MeasureString(e.Graphics, designerTheme.Font, this.HelpText, StringAlignment.Center, DefaultHelpTextSize);
                }
                size.Height += designerTheme.ConnectorSize.Height;
                foreach (ActivityDesigner designer in this.ContainedDesigners)
                {
                    Size size2 = designer.Size;
                    size.Width   = Math.Max(size.Width, size2.Width);
                    size.Height += size2.Height;
                    size.Height += designerTheme.ConnectorSize.Height;
                }
                if (this.ContainedDesigners.Count == 0)
                {
                    Rectangle helpTextRectangle = this.HelpTextRectangle;
                    size.Width   = Math.Max(helpTextRectangle.Width, size.Width);
                    size.Height += helpTextRectangle.Height;
                    size.Height += designerTheme.ConnectorSize.Height;
                }
                size.Width  = Math.Max(size.Width, designerTheme.Size.Width);
                size.Width += 3 * e.AmbientTheme.Margin.Width;
                size.Width += 2 * e.AmbientTheme.SelectionSize.Width;
                size.Height = Math.Max(size.Height, designerTheme.Size.Height);
            }
            return(size);
        }
        /// <summary>
        /// Layouts the visual cues inside Header/Footer
        /// </summary>
        /// <param name="e">ActivityDesignerLayoutEventArgs holding layouting arguments</param>
        public virtual void OnLayout(ActivityDesignerLayoutEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            if (!String.IsNullOrEmpty(Text) && e.DesignerTheme != null && e.DesignerTheme.Font != null)
            {
                using (Font font = new Font(e.DesignerTheme.Font.FontFamily, e.DesignerTheme.Font.SizeInPoints + 1.0f, FontStyle.Bold))
                    this.textSize = ActivityDesignerPaint.MeasureString(e.Graphics, font, Text, StringAlignment.Center, Size.Empty);
            }
        }
Example #3
0
        protected override Size OnLayoutSize(ActivityDesignerLayoutEventArgs e)
        {
            Size containerSize = base.OnLayoutSize(e);

            CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;

            if (Expanded && ActiveDesigner == this && compositeDesignerTheme != null)
            {
                if (this.HelpText.Length > 0)
                {
                    this.helpTextSize = ActivityDesignerPaint.MeasureString(e.Graphics, compositeDesignerTheme.Font, this.HelpText, StringAlignment.Center, SequentialActivityDesigner.DefaultHelpTextSize);
                }

                //Calculate the size based on child size
                containerSize.Height += compositeDesignerTheme.ConnectorSize.Height; //Add the height of first connector

                foreach (ActivityDesigner activityDesigner in ContainedDesigners)
                {
                    Size childSize = activityDesigner.Size;
                    containerSize.Width   = Math.Max(containerSize.Width, childSize.Width);
                    containerSize.Height += childSize.Height;
                    containerSize.Height += compositeDesignerTheme.ConnectorSize.Height;
                }

                if (ContainedDesigners.Count == 0)
                {
                    Rectangle helpTextRectangle = HelpTextRectangle;
                    containerSize.Width   = Math.Max(helpTextRectangle.Width, containerSize.Width);
                    containerSize.Height += helpTextRectangle.Height;
                    containerSize.Height += compositeDesignerTheme.ConnectorSize.Height; //Add the height of last connector
                }

                containerSize.Width  = Math.Max(containerSize.Width, compositeDesignerTheme.Size.Width);
                containerSize.Width += 3 * e.AmbientTheme.Margin.Width;
                containerSize.Width += 2 * e.AmbientTheme.SelectionSize.Width;
                containerSize.Height = Math.Max(containerSize.Height, compositeDesignerTheme.Size.Height);
            }

            return(containerSize);
        }