public ActivityDesignerPaintEventArgs(System.Drawing.Graphics graphics, Rectangle clipRectangle, Rectangle viewPort, ActivityDesignerTheme designerTheme)
 {
     this.graphics      = graphics;
     this.clipRectangle = Rectangle.Inflate(clipRectangle, 1, 1);
     this.viewPort      = viewPort;
     this.designerTheme = designerTheme;
 }
 public ActivityDesignerPaintEventArgs(System.Drawing.Graphics graphics, Rectangle clipRectangle, Rectangle viewPort, ActivityDesignerTheme designerTheme)
 {
     this.graphics = graphics;
     this.clipRectangle = Rectangle.Inflate(clipRectangle, 1, 1);
     this.viewPort = viewPort;
     this.designerTheme = designerTheme;
 }
 protected override void OnThemeChange(ActivityDesignerTheme newTheme)
 {
     base.OnThemeChange(newTheme);
     if (WorkflowTheme.CurrentTheme.AmbientTheme.ShowGrid)
     {
         foreach (ActivityDesigner designer in this.ContainedDesigners)
         {
             designer.Location = DesignerHelpers.SnapToGrid(designer.Location);
         }
         base.PerformLayout();
     }
 }
            public override void OnLayoutSize(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme, Size containerSize)
            {
                base.OnLayoutSize(graphics, designerTheme, ambientTheme, containerSize);

                InitializeLayouts();

                CompositeDesignerTheme compositeDesignerTheme = designerTheme as CompositeDesignerTheme;
                if (compositeDesignerTheme == null)
                    return;

                Font font = designerTheme.BoldFont;
                _breadCrumbSeparatorSize = StateMachineDesignerPaint.MeasureString(graphics, font, BreadCrumbSeparator, StringAlignment.Near, Size.Empty);
                Size size = Size.Empty;

                foreach (Layout layout in Layouts)
                {
                    layout.OnLayoutSize(graphics, compositeDesignerTheme, ambientTheme, size);
                    size.Width += layout.Size.Width + _breadCrumbSeparatorSize.Width;
                    size.Height = Math.Max(size.Height, layout.Size.Height);
                }

                this.MinimumSize = size;
                this.Size = size;
            }
            public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
            {
                GraphicsPath path = StateMachineDesignerPaint.GetDesignerPath(this.ActivityDesigner, this.Bounds, designerTheme);
                Brush backgroundBrush = designerTheme.GetBackgroundBrush(this.Bounds);
                graphics.FillPath(backgroundBrush, path);

                base.OnPaint(graphics, designerTheme, ambientTheme);

                if (ambientTheme.ShowDesignerBorder)
                    graphics.DrawPath(designerTheme.BorderPen, path);

                if (this.StateDesigner.ContainedDesigners.Count == 0 &&
                    !this.StateDesigner.IsStateCustomActivity)
                {
                    Point location = new Point(this.Location.X, _titleBarLayout.Bounds.Bottom);
                    Size size = new Size(this.Size.Width, this.Size.Height - _titleBarLayout.Bounds.Height);
                    Rectangle rectangle = new Rectangle(location, size);
                    rectangle.Inflate(-1, -1);

                    StateActivity state = (StateActivity)this.StateDesigner.Activity;
                    if (StateMachineHelpers.IsLeafState(state) &&
                        StateMachineHelpers.IsCompletedState(state))
                        return;

                    if (this.StateDesigner.DragDropActive)
                    {
                        Color color = Color.FromArgb(64, designerTheme.ForeColor);
                        using (SolidBrush brush = new SolidBrush(color))
                        {
                            ActivityDesignerPaint.DrawText(
                                graphics,
                                designerTheme.Font,
                                this.StateDesigner.HelpText,
                                rectangle,
                                StringAlignment.Center,
                                ambientTheme.TextQuality,
                                brush);
                        }
                    }
                    else
                    {
                        ActivityDesignerPaint.DrawText(
                            graphics,
                            designerTheme.Font,
                            this.StateDesigner.HelpText,
                            rectangle,
                            StringAlignment.Center,
                            ambientTheme.TextQuality,
                            designerTheme.ForegroundBrush);
                    }
                }
            }
Ejemplo n.º 6
0
        internal DesignerTheme GetTheme(System.Type designerType)
        {
            bool          readOnly = this.ReadOnly;
            DesignerTheme item     = this.designerThemes.Contains(designerType.FullName) ? this.designerThemes[designerType.FullName] : null;

            try
            {
                this.ReadOnly = false;
                if ((item == null) || ((item.DesignerType != null) && !designerType.Equals(item.DesignerType)))
                {
                    bool flag2 = item != null;
                    ActivityDesignerThemeAttribute attribute = TypeDescriptor.GetAttributes(designerType)[typeof(ActivityDesignerThemeAttribute)] as ActivityDesignerThemeAttribute;
                    if (attribute == null)
                    {
                        throw new InvalidOperationException(DR.GetString("Error_ThemeAttributeMissing", new object[] { designerType.FullName }));
                    }
                    if (attribute.DesignerThemeType == null)
                    {
                        throw new InvalidOperationException(DR.GetString("Error_ThemeTypeMissing", new object[] { designerType.FullName }));
                    }
                    if (attribute.Xml.Length > 0)
                    {
                        Stream manifestResourceStream = designerType.Assembly.GetManifestResourceStream(designerType, attribute.Xml);
                        if (manifestResourceStream == null)
                        {
                            manifestResourceStream = designerType.Assembly.GetManifestResourceStream("System.Workflow.ComponentModel.Design.ActivityDesignerThemes." + attribute.Xml);
                        }
                        XmlReader reader = (manifestResourceStream != null) ? XmlReader.Create(manifestResourceStream) : null;
                        if (reader == null)
                        {
                            reader = XmlReader.Create(new StringReader(attribute.Xml));
                        }
                        if (reader != null)
                        {
                            DesignerSerializationManager serializationManager = new DesignerSerializationManager();
                            using (serializationManager.CreateSession())
                            {
                                ThemeSerializationProvider provider = new ThemeSerializationProvider();
                                try
                                {
                                    ((IDesignerSerializationManager)serializationManager).AddSerializationProvider(provider);
                                    ((IDesignerSerializationManager)serializationManager).Context.Push(this);
                                    WorkflowMarkupSerializer serializer = new WorkflowMarkupSerializer();
                                    item = serializer.Deserialize(serializationManager, reader) as DesignerTheme;
                                    if ((item != null) && !attribute.DesignerThemeType.IsAssignableFrom(item.GetType()))
                                    {
                                        ((IDesignerSerializationManager)serializationManager).ReportError(new WorkflowMarkupSerializationException(DR.GetString("ThemeTypesMismatch", new object[] { attribute.DesignerThemeType.FullName, item.GetType().FullName })));
                                        item = null;
                                    }
                                    if (serializationManager.Errors.Count > 0)
                                    {
                                        string str = string.Empty;
                                        foreach (object obj2 in serializationManager.Errors)
                                        {
                                            str = str + obj2.ToString() + @"\n";
                                        }
                                    }
                                }
                                finally
                                {
                                    ((IDesignerSerializationManager)serializationManager).RemoveSerializationProvider(provider);
                                    reader.Close();
                                }
                            }
                        }
                    }
                    if (item == null)
                    {
                        try
                        {
                            item = Activator.CreateInstance(attribute.DesignerThemeType, new object[] { this }) as DesignerTheme;
                        }
                        catch
                        {
                            item = new ActivityDesignerTheme(this);
                        }
                    }
                    item.DesignerType = designerType;
                    item.ApplyTo      = designerType.FullName;
                    item.Initialize();
                    if (flag2)
                    {
                        this.designerThemes.Remove(designerType.FullName);
                    }
                    this.designerThemes.Add(item);
                }
                if (item.DesignerType == null)
                {
                    item.DesignerType = designerType;
                }
            }
            finally
            {
                this.ReadOnly = readOnly;
            }
            return(item);
        }
            public override void OnLayoutSize(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme, Size containerSize)
            {
                base.OnLayoutSize(graphics, designerTheme, ambientTheme, containerSize);

                Size minimumSize = new Size();
                _textLayout.OnLayoutSize(graphics, designerTheme, ambientTheme, Size.Empty);
                _imageLayout.OnLayoutSize(graphics, designerTheme, ambientTheme, Size.Empty);

                minimumSize.Width = designerTheme.BorderWidth * 2 + 10 + _textLayout.Size.Width + _imageLayout.Size.Width;
                minimumSize.Height = Math.Max(_textLayout.Size.Height, _imageLayout.Size.Height);
                minimumSize.Height += designerTheme.BorderWidth * 2 + 4;

                this.MinimumSize = minimumSize;
                Size size = minimumSize;
                size.Width = Math.Max(minimumSize.Width, containerSize.Width);
                this.Size = size;
            }
            public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
            {
                Rectangle rectangle = this.Bounds;

                Brush backgroundBrush = designerTheme.GetBackgroundBrush(this.Bounds);
                graphics.FillRectangle(backgroundBrush, rectangle);

                Color color1;
                Color color2;
                StateActivity state = (StateActivity)this.ActivityDesigner.Activity;
                if (StateMachineHelpers.IsLeafState(state))
                {
                    color1 = Color.FromArgb(32, designerTheme.BorderColor);
                    color2 = Color.FromArgb(160, designerTheme.BorderColor);
                }
                else
                {
                    if (StateMachineHelpers.IsRootState(state))
                    {
                        color1 = Color.Empty;
                        color2 = Color.FromArgb(128, designerTheme.BorderColor);
                    }
                    else
                    {
                        color1 = Color.FromArgb(16, designerTheme.BorderColor);
                        color2 = Color.FromArgb(16, designerTheme.BorderColor);
                    }
                }

                if (rectangle.Width > 0 && rectangle.Height > 0)
                {
                    using (Brush linearGradientBrush = new LinearGradientBrush(rectangle, color1, color2, LinearGradientMode.Vertical))
                    {
                        graphics.FillRectangle(linearGradientBrush, rectangle);
                        graphics.DrawLine(designerTheme.BorderPen, rectangle.Left, rectangle.Bottom, rectangle.Right, rectangle.Bottom);
                    }
                }

                base.OnPaint(graphics, designerTheme, ambientTheme);
            }
            public override void OnLayoutSize(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme, Size containerSize)
            {
                base.OnLayoutSize(graphics, designerTheme, ambientTheme, containerSize);

                CompositeDesignerTheme compositeDesignerTheme = designerTheme as CompositeDesignerTheme;
                string text = this.ActivityDesigner.Text;
                Size size = Size.Empty;
                if (compositeDesignerTheme != null && !String.IsNullOrEmpty(text))
                {
                    size = StateMachineDesignerPaint.MeasureString(graphics, compositeDesignerTheme.Font, text, StringAlignment.Center, Size.Empty);
                }
                this.MinimumSize = size;
                this.Size = size;
            }
            public override void OnLayoutSize(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme, Size containerSize)
            {
                base.OnLayoutSize(graphics, designerTheme, ambientTheme, containerSize);

                CompositeDesignerTheme compositeDesignerTheme = designerTheme as CompositeDesignerTheme;
                Size size = Size.Empty;
                if (this.ActivityDesigner.Image != null && compositeDesignerTheme != null)
                {
                    size = designerTheme.ImageSize;
                }
                this.MinimumSize = size;
                this.Size = size;
            }
 public virtual void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
 {
     foreach (Layout layout in _layouts)
     {
         layout.OnPaint(graphics, designerTheme, ambientTheme);
     }
 }
            public override void OnLayoutSize(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme, Size containerSize)
            {
                base.OnLayoutSize(graphics, designerTheme, ambientTheme, containerSize);

                _imageSize = designerTheme.ImageSize;
                string text = this.Text;
                Font font = designerTheme.Font;
                _textSize = StateMachineDesignerPaint.MeasureString(graphics, font, text, StringAlignment.Near, Size.Empty);
                int width = _imageSize.Width + ImagePadding + _textSize.Width;
                width += ambientTheme.Margin.Width * 2;
                int height = Math.Max(_imageSize.Height, _textSize.Height);
                height += ambientTheme.Margin.Height;
                Size size = new Size(width, height);
                this.MinimumSize = size;
                this.Size = size;
            }
 public virtual void OnLayoutSize(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme, Size containerSize)
 {
 }
 public virtual void OnLayoutPosition(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
 {
 }
            public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
            {
                GraphicsPath path = StateMachineDesignerPaint.GetDesignerPath(this.ActivityDesigner, this.Bounds, designerTheme);
                Brush backgroundBrush = designerTheme.GetBackgroundBrush(this.Bounds);
                graphics.FillPath(backgroundBrush, path);

                base.OnPaint(graphics, designerTheme, ambientTheme);

                if (ambientTheme.ShowDesignerBorder)
                    graphics.DrawPath(designerTheme.BorderPen, path);
            }
            public override void OnLayoutPosition(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
            {
                CompositeDesignerTheme compositeDesignerTheme = designerTheme as CompositeDesignerTheme;
                if (compositeDesignerTheme == null)
                    return;

                Rectangle bounds = this.Bounds;
                Point origin = bounds.Location;
                if (this.StateDesigner.IsRootStateDesigner)
                {
                    _titleBarLayout.Location = origin;
                    _titleBarLayout.OnLayoutPosition(graphics, designerTheme, ambientTheme);
                    origin.X += ActiveDesignerPadding;
                    origin.Y += _titleBarLayout.Size.Height + ActiveDesignerPadding;
                    _breadCrumbBarLayout.Location = origin;
                    _breadCrumbBarLayout.OnLayoutPosition(graphics, designerTheme, ambientTheme);
                    origin.Y += _breadCrumbBarLayout.Size.Height + ActiveDesignerPadding;
                }
                else
                {
                    Point designerLayoutLocation = new Point(
                        bounds.Left + (bounds.Width - _designerLayout.Size.Width) / 2,
                        bounds.Top + ambientTheme.SelectionSize.Height);
                    _designerLayout.Location = designerLayoutLocation;
                    _designerLayout.OnLayoutPosition(graphics, designerTheme, ambientTheme);
                    origin.Y = _designerLayout.Bounds.Bottom + ambientTheme.SelectionSize.Height + ActiveDesignerPadding;
                }

                Size activeDesignerSize = this.StateDesigner.ActiveDesigner.Size;
                origin.X = bounds.Left + (bounds.Width - activeDesignerSize.Width) / 2;

                this.StateDesigner.ActiveDesigner.Location = origin;
            }
            public override void OnLayoutSize(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme, Size containerSize)
            {
                base.OnLayoutSize(graphics, designerTheme, ambientTheme, containerSize);

                InitializeLayout();

                Size size = containerSize;
                Size minSize = this.StateDesigner.MinimumSize;
                size.Width = Math.Max(size.Width, minSize.Width);
                size.Height = Math.Max(size.Height, minSize.Height);

                ActivityDesigner activeDesigner = this.StateDesigner.ActiveDesigner;
                Size activeDesignerSize = activeDesigner.Size;

                if (this.StateDesigner.IsRootStateDesigner)
                {
                    _titleBarLayout.OnLayoutSize(graphics, designerTheme, ambientTheme, size);
                    _breadCrumbBarLayout.OnLayoutSize(graphics, designerTheme, ambientTheme, size);

                    size.Width = Math.Max(size.Width, activeDesignerSize.Width + ActiveDesignerPadding * 2);
                    size.Width = Math.Max(size.Width, _titleBarLayout.Size.Width);
                    size.Width = Math.Max(size.Width, _breadCrumbBarLayout.Size.Width);

                    int minHeight =
                        activeDesignerSize.Height +
                        _titleBarLayout.Size.Height +
                        _breadCrumbBarLayout.Size.Height +
                        ActiveDesignerPadding * 3 +
                        ambientTheme.SelectionSize.Height * 2;
                    size.Height = Math.Max(size.Height, minHeight);
                    _titleBarLayout.ResizeLayout(new Size(size.Width, _titleBarLayout.Size.Height));
                }
                else
                {
                    _designerLayout.OnLayoutSize(graphics, designerTheme, ambientTheme, size);
                    size.Width = Math.Max(size.Width, activeDesigner.Size.Width + ActiveDesignerPadding * 2);
                    size.Width = Math.Max(size.Width, _designerLayout.Size.Width);
                    size.Height = Math.Max(size.Height, activeDesigner.Size.Height + ActiveDesignerPadding * 2 + _designerLayout.Size.Height + ambientTheme.SelectionSize.Height * 2);
                }

                this.MinimumSize = size;
                this.Size = size;
            }
 public override void OnLayoutPosition(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
 {
     Point location = this.Location;
     foreach (Layout layout in this.Layouts)
     {
         layout.Location = location;
         layout.OnLayoutPosition(graphics, designerTheme, ambientTheme);
         location.X += layout.Size.Width + _breadCrumbSeparatorSize.Width;
     }
 }
 public override void OnLayoutPosition(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
 {
     base.OnLayoutPosition(graphics, designerTheme, ambientTheme);
     Point origin = this.Location;
     origin.X += ambientTheme.Margin.Width;
     origin.Y += ambientTheme.Margin.Height / 2;
     _imageLocation = origin;
     origin.X += _imageSize.Width + ImagePadding;
     _textLocation = origin;
 }
            public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
            {
                if (Layouts.Count == 0)
                    return;

                Font font = designerTheme.BoldFont;
                TextQuality textQuality = ambientTheme.TextQuality;
                Brush brush = designerTheme.ForegroundBrush;

                List<Layout> layouts = this.Layouts;
                Layout layout;
                for (int i = 0; i < layouts.Count - 1; i++)
                {
                    layout = layouts[i];
                    layout.OnPaint(graphics, designerTheme, ambientTheme);

                    Rectangle separatorRectangle = new Rectangle(
                        layout.Bounds.Right,
                        layout.Location.Y,
                        _breadCrumbSeparatorSize.Width,
                        _breadCrumbSeparatorSize.Height);

                    ActivityDesignerPaint.DrawText(graphics, font, BreadCrumbSeparator, separatorRectangle,
                        StringAlignment.Near, textQuality, brush);
                }

                // draw the last one
                layout = layouts[layouts.Count - 1];
                layout.OnPaint(graphics, designerTheme, ambientTheme);
            }
            public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
            {
                ActivityDesigner activityDesigner = this.ActivityDesigner;

                Font font = designerTheme.Font;

                Image image = StateDesigner.GetDesignerImage(activityDesigner);
                if (image != null)
                    ActivityDesignerPaint.DrawImage(graphics, image, this.ImageRectangle, DesignerContentAlignment.Fill);

                ActivityDesignerPaint.DrawText(graphics, font, this.Text, TextRectangle, StringAlignment.Near, ambientTheme.TextQuality, designerTheme.ForegroundBrush);
            }
            public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
            {
                string text = this.ActivityDesigner.Text;
                if (String.IsNullOrEmpty(text))
                    return;

                Font font = designerTheme.Font;
                ActivityDesignerPaint.DrawText(graphics, font, text, this.Bounds, StringAlignment.Near, ambientTheme.TextQuality, designerTheme.ForegroundBrush);
            }
 protected override void OnThemeChange(ActivityDesignerTheme newTheme)
 {
     base.OnThemeChange(newTheme);
     if (WorkflowTheme.CurrentTheme.AmbientTheme.ShowGrid)
     {
         foreach (ActivityDesigner designer in this.ContainedDesigners)
         {
             designer.Location = DesignerHelpers.SnapToGrid(designer.Location);
         }
         base.PerformLayout();
     }
 }
 public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
 {
     Image image = this.ActivityDesigner.Image;
     if (image != null)
         ActivityDesignerPaint.DrawImage(graphics, image, this.Bounds, DesignerContentAlignment.Fill);
 }
Ejemplo n.º 25
0
 protected override void OnThemeChange(ActivityDesignerTheme newTheme)
 {
     base.OnThemeChange(newTheme);
     this.RefreshPreview();
 }
            public override void OnLayoutPosition(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
            {
                Size margin = WorkflowTheme.CurrentTheme.AmbientTheme.Margin;
                Point origin = this.Location;
                origin.X += margin.Width;
                origin.Y += 2;

                _imageLayout.Location = origin;

                CalculateTextLayout();
            }
        /// <summary>
        /// Notifies the designer that the associated theme has changed.
        /// </summary>
        protected virtual void OnThemeChange(ActivityDesignerTheme newTheme)
        {
            if (newTheme == null)
                throw new ArgumentNullException("newTheme");

            this.Image = StockImage;
        }
            public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
            {
                ActivityDesigner activityDesigner = this.ActivityDesigner;

                if (this.MouseOver)
                {
                    using (Font font = new Font(designerTheme.Font, FontStyle.Underline | designerTheme.Font.Style))
                    {
                        Image image = StateDesigner.GetDesignerImage(activityDesigner);
                        if (image != null)
                            ActivityDesignerPaint.DrawImage(graphics, image, this.ImageRectangle, DesignerContentAlignment.Fill);

                        ActivityDesignerPaint.DrawText(graphics, font, this.Text, TextRectangle, StringAlignment.Near, ambientTheme.TextQuality, designerTheme.ForegroundBrush);
                    }
                }
                else
                    base.OnPaint(graphics, designerTheme, ambientTheme);
            }
            public override void OnLayoutPosition(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
            {
                _titleBarLayout.Location = this.Location;
                _titleBarLayout.OnLayoutPosition(graphics, designerTheme, ambientTheme);

                int x = this.Location.X;
                int y = _titleBarLayout.Bounds.Bottom + 1;

                _eventHandlersLayout.Location = new Point(x, y);
                _eventHandlersLayout.OnLayoutPosition(graphics, designerTheme, ambientTheme);
            }
            public override void OnLayoutSize(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme, Size containerSize)
            {
                Size selectionSize = ambientTheme.SelectionSize;
                Size minimumSize = new Size();

                foreach (Layout layout in Layouts)
                {
                    layout.OnLayoutSize(graphics, designerTheme, ambientTheme, minimumSize);
                    minimumSize.Height += layout.Size.Height;
                    minimumSize.Height += selectionSize.Height;
                    int layoutWidth = layout.Size.Width + 2 * (selectionSize.Width + ambientTheme.Margin.Width);
                    minimumSize.Width = Math.Max(minimumSize.Width, layoutWidth);
                }

                if (this.Layouts.Count > 0)
                    minimumSize.Height += EventDrivenPadding;

                this.MinimumSize = minimumSize;

                Size size = new Size();
                size.Width = Math.Max(containerSize.Width, minimumSize.Height);
                size.Height = minimumSize.Height;
                this.Size = size;
            }
 public override void OnLayoutPosition(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
 {
     Size selectionSize = ambientTheme.SelectionSize;
     int x = Location.X + EventDrivenPadding;
     int y = Location.Y + EventDrivenPadding;
     foreach (Layout layout in this.Layouts)
     {
         layout.Location = new Point(x, y);
         DesignerLayoutBase designerLayout = layout as DesignerLayoutBase;
         if (designerLayout != null)
             designerLayout.ActivityDesigner.Location = layout.Location;
         layout.OnLayoutPosition(graphics, designerTheme, ambientTheme);
         y += layout.Size.Height + selectionSize.Height;
     }
 }
        internal static GraphicsPath GetDesignerPath(ActivityDesigner designer, Rectangle bounds, ActivityDesignerTheme designerTheme)
        {
            GraphicsPath designerPath = new GraphicsPath();

            if (designer == GetSafeRootDesigner(designer.Activity.Site) && ((IWorkflowRootDesigner)designer).InvokingDesigner == null)
            {
                designerPath.AddRectangle(bounds);
            }
            else
            {
                // Work around: This should come from AmbientTheme.ArcDiameter
                // but it is internal
                int arcDiameter = 8;
                if (designerTheme != null && designerTheme.DesignerGeometry == DesignerGeometry.RoundedRectangle)
                    designerPath.AddPath(ActivityDesignerPaint.GetRoundedRectanglePath(bounds, arcDiameter), true);
                else
                    designerPath.AddRectangle(bounds);
            }

            return designerPath;
        }
            public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
            {
                base.OnPaint(graphics, designerTheme, ambientTheme);

                StateDesigner stateDesigner = (StateDesigner)this.ActivityDesigner;
                ContainedDesignersParser parser = stateDesigner._designersParser;
                // we only draw the separation line
                // if we have at least one event driven and one state
                if ((parser.EventDrivenDesigners.Count > 0 || parser.StateInitializationDesigners.Count > 0 || parser.StateFinalizationDesigners.Count > 0) &&
                    (parser.StateDesigners.Count > 0 || parser.LeafStateDesigners.Count > 0))
                {
                    Rectangle bounds = this.Bounds;
                    graphics.DrawLine(designerTheme.BorderPen, bounds.Left, bounds.Bottom, bounds.Right, bounds.Bottom);
                }
            }
        protected override void OnThemeChange(ActivityDesignerTheme designerTheme)
        {
            base.OnThemeChange(designerTheme);

            CompositeActivity compositeActivity = Activity as CompositeActivity;
            if (compositeActivity != null)
            {
                foreach (Activity activity in compositeActivity.Activities)
                {
                    IWorkflowDesignerMessageSink containedDesigner = ActivityDesigner.GetDesigner(activity) as IWorkflowDesignerMessageSink;
                    if (containedDesigner != null)
                        containedDesigner.OnThemeChange();
                }
            }
        }
Ejemplo n.º 35
0
 public ActivityDesignerLayoutEventArgs(System.Drawing.Graphics graphics, ActivityDesignerTheme designerTheme)
 {
     this.graphics      = graphics;
     this.designerTheme = designerTheme;
 }