public CompositeDesignerTheme(WorkflowTheme theme) : base(theme)
 {
     this.watermarkAlignment = DesignerContentAlignment.BottomRight;
     this.watermarkImagePath = string.Empty;
     this.endCap = LineAnchor.ArrowAnchor;
     this.expandButtonRectangle = Rectangle.Empty;
 }
 public CompositeDesignerTheme(WorkflowTheme theme) : base(theme)
 {
     this.watermarkAlignment    = DesignerContentAlignment.BottomRight;
     this.watermarkImagePath    = string.Empty;
     this.endCap                = LineAnchor.ArrowAnchor;
     this.expandButtonRectangle = Rectangle.Empty;
 }
 public AmbientTheme(WorkflowTheme theme) : base(theme)
 {
     this.showConfigErrors       = true;
     this.dropIndicatorColor     = System.Drawing.Color.Green;
     this.selectionForeColor     = System.Drawing.Color.Blue;
     this.selectionPatternColor  = System.Drawing.Color.DarkGray;
     this.foreColor              = System.Drawing.Color.Gray;
     this.backColor              = System.Drawing.Color.White;
     this.commentIndicatorColor  = System.Drawing.Color.FromArgb(0x31, 0xc6, 0x69);
     this.readonlyIndicatorColor = System.Drawing.Color.Gray;
     this.watermarkAlignment     = DesignerContentAlignment.BottomRight;
     this.watermarkImagePath     = string.Empty;
     this.gridStyle              = DashStyle.Dash;
     this.gridColor              = System.Drawing.Color.FromArgb(0xc0, 0xc0, 0xc0);
     this.fontName           = WorkflowTheme.GetDefaultFont().FontFamily.Name;
     this.designerStyle      = System.Workflow.ComponentModel.Design.DesignerSize.Medium;
     this.drawRounded        = true;
     this.showDesignerBorder = true;
 }
 internal static Rectangle GetRectangleFromAlignment(DesignerContentAlignment alignment, Rectangle destination, Size size)
 {
     if (size.IsEmpty || destination.IsEmpty)
     {
         return Rectangle.Empty;
     }
     Rectangle empty = Rectangle.Empty;
     empty.Width = Math.Min(size.Width, destination.Width);
     empty.Height = Math.Min(size.Height, destination.Height);
     if ((alignment & DesignerContentAlignment.Fill) > ((DesignerContentAlignment) 0))
     {
         return destination;
     }
     if ((alignment & DesignerContentAlignment.Left) > ((DesignerContentAlignment) 0))
     {
         empty.X = destination.Left;
     }
     else if ((alignment & DesignerContentAlignment.Right) > ((DesignerContentAlignment) 0))
     {
         empty.X = destination.Right - empty.Width;
     }
     else
     {
         empty.X = (destination.Left + (destination.Width / 2)) - (empty.Width / 2);
     }
     if ((alignment & DesignerContentAlignment.Top) > ((DesignerContentAlignment) 0))
     {
         empty.Y = destination.Top;
         return empty;
     }
     if ((alignment & DesignerContentAlignment.Bottom) > ((DesignerContentAlignment) 0))
     {
         empty.Y = destination.Bottom - empty.Height;
         return empty;
     }
     empty.Y = (destination.Top + (destination.Height / 2)) - (empty.Height / 2);
     return empty;
 }
 internal static GraphicsPath[] GetPagePaths(Rectangle pageBounds, int pageFoldSize, DesignerContentAlignment foldAlignment)
 {
     GraphicsPath[] pathArray = new GraphicsPath[2];
     if (foldAlignment == DesignerContentAlignment.TopLeft)
     {
         pathArray[0] = new GraphicsPath();
         pathArray[0].AddLine(pageBounds.Left, pageBounds.Top + pageFoldSize, pageBounds.Left + pageFoldSize, pageBounds.Top + pageFoldSize);
         pathArray[0].AddLine(pageBounds.Left + pageFoldSize, pageBounds.Top + pageFoldSize, pageBounds.Left + pageFoldSize, pageBounds.Top);
         pathArray[0].AddLine(pageBounds.Left + pageFoldSize, pageBounds.Top, pageBounds.Right, pageBounds.Top);
         pathArray[0].AddLine(pageBounds.Right, pageBounds.Top, pageBounds.Right, pageBounds.Bottom);
         pathArray[0].AddLine(pageBounds.Right, pageBounds.Bottom, pageBounds.Left, pageBounds.Bottom);
         pathArray[0].AddLine(pageBounds.Left, pageBounds.Bottom, pageBounds.Left, pageBounds.Top + pageFoldSize);
         pathArray[1] = new GraphicsPath();
         pathArray[1].AddLine(pageBounds.Left, pageBounds.Top + pageFoldSize, pageBounds.Left + pageFoldSize, pageBounds.Top + pageFoldSize);
         pathArray[1].AddLine(pageBounds.Left + pageFoldSize, pageBounds.Top + pageFoldSize, pageBounds.Left + pageFoldSize, pageBounds.Top);
         pathArray[1].AddLine(pageBounds.Left + pageFoldSize, pageBounds.Top, pageBounds.Left, pageBounds.Top + pageFoldSize);
         return pathArray;
     }
     if (foldAlignment == DesignerContentAlignment.BottomLeft)
     {
         pathArray[0] = new GraphicsPath();
         pathArray[0].AddLine(pageBounds.Left, pageBounds.Top, pageBounds.Right, pageBounds.Top);
         pathArray[0].AddLine(pageBounds.Right, pageBounds.Top, pageBounds.Right, pageBounds.Bottom);
         pathArray[0].AddLine(pageBounds.Right, pageBounds.Bottom, pageBounds.Left + pageFoldSize, pageBounds.Bottom);
         pathArray[0].AddLine(pageBounds.Left + pageFoldSize, pageBounds.Bottom, pageBounds.Left + pageFoldSize, pageBounds.Bottom - pageFoldSize);
         pathArray[0].AddLine(pageBounds.Left + pageFoldSize, pageBounds.Bottom - pageFoldSize, pageBounds.Left, pageBounds.Bottom - pageFoldSize);
         pathArray[0].AddLine(pageBounds.Left, pageBounds.Bottom - pageFoldSize, pageBounds.Left, pageBounds.Top);
         pathArray[1] = new GraphicsPath();
         pathArray[1].AddLine(pageBounds.Left + pageFoldSize, pageBounds.Bottom, pageBounds.Left + pageFoldSize, pageBounds.Bottom - pageFoldSize);
         pathArray[1].AddLine(pageBounds.Left + pageFoldSize, pageBounds.Bottom - pageFoldSize, pageBounds.Left, pageBounds.Bottom - pageFoldSize);
         pathArray[1].AddLine(pageBounds.Left, pageBounds.Bottom - pageFoldSize, pageBounds.Left + pageFoldSize, pageBounds.Bottom);
         return pathArray;
     }
     if (foldAlignment == DesignerContentAlignment.TopRight)
     {
         pathArray[0] = new GraphicsPath();
         pathArray[0].AddLine(pageBounds.Left, pageBounds.Top, pageBounds.Right - pageFoldSize, pageBounds.Top);
         pathArray[0].AddLine(pageBounds.Right - pageFoldSize, pageBounds.Top, pageBounds.Right - pageFoldSize, pageBounds.Top + pageFoldSize);
         pathArray[0].AddLine(pageBounds.Right - pageFoldSize, pageBounds.Top + pageFoldSize, pageBounds.Right, pageBounds.Top + pageFoldSize);
         pathArray[0].AddLine(pageBounds.Right, pageBounds.Top + pageFoldSize, pageBounds.Right, pageBounds.Bottom);
         pathArray[0].AddLine(pageBounds.Right, pageBounds.Bottom, pageBounds.Left, pageBounds.Bottom);
         pathArray[0].AddLine(pageBounds.Left, pageBounds.Bottom, pageBounds.Left, pageBounds.Top);
         pathArray[1] = new GraphicsPath();
         pathArray[1].AddLine(pageBounds.Right - pageFoldSize, pageBounds.Top, pageBounds.Right - pageFoldSize, pageBounds.Top + pageFoldSize);
         pathArray[1].AddLine(pageBounds.Right - pageFoldSize, pageBounds.Top + pageFoldSize, pageBounds.Right, pageBounds.Top + pageFoldSize);
         pathArray[1].AddLine(pageBounds.Right, pageBounds.Top + pageFoldSize, pageBounds.Right - pageFoldSize, pageBounds.Top);
         return pathArray;
     }
     if (foldAlignment == DesignerContentAlignment.BottomRight)
     {
         pathArray[0] = new GraphicsPath();
         pathArray[0].AddLine(pageBounds.Left, pageBounds.Top, pageBounds.Right, pageBounds.Top);
         pathArray[0].AddLine(pageBounds.Right, pageBounds.Top, pageBounds.Right, pageBounds.Bottom - pageFoldSize);
         pathArray[0].AddLine(pageBounds.Right, pageBounds.Bottom - pageFoldSize, pageBounds.Right - pageFoldSize, pageBounds.Bottom - pageFoldSize);
         pathArray[0].AddLine(pageBounds.Right - pageFoldSize, pageBounds.Bottom - pageFoldSize, pageBounds.Right - pageFoldSize, pageBounds.Bottom);
         pathArray[0].AddLine(pageBounds.Right - pageFoldSize, pageBounds.Bottom, pageBounds.Left, pageBounds.Bottom);
         pathArray[0].AddLine(pageBounds.Left, pageBounds.Bottom, pageBounds.Left, pageBounds.Top);
         pathArray[1] = new GraphicsPath();
         pathArray[1].AddLine(pageBounds.Right, pageBounds.Bottom - pageFoldSize, pageBounds.Right - pageFoldSize, pageBounds.Bottom - pageFoldSize);
         pathArray[1].AddLine(pageBounds.Right - pageFoldSize, pageBounds.Bottom - pageFoldSize, pageBounds.Right - pageFoldSize, pageBounds.Bottom);
         pathArray[1].AddLine(pageBounds.Right - pageFoldSize, pageBounds.Bottom, pageBounds.Right, pageBounds.Bottom - pageFoldSize);
     }
     return pathArray;
 }
 public static void DrawImage(Graphics graphics, Image image, Rectangle destination, Rectangle source, DesignerContentAlignment alignment, float transparency, bool grayscale)
 {
     if (graphics == null)
     {
         throw new ArgumentNullException("graphics");
     }
     if (image == null)
     {
         throw new ArgumentNullException("image");
     }
     if (destination.IsEmpty)
     {
         throw new ArgumentNullException("destination");
     }
     if (source.IsEmpty)
     {
         throw new ArgumentNullException("source");
     }
     if ((transparency < 0f) || (transparency > 1f))
     {
         throw new ArgumentNullException("transparency");
     }
     Rectangle destRect = GetRectangleFromAlignment(alignment, destination, source.Size);
     if ((image != null) && !destRect.IsEmpty)
     {
         ColorMatrix newColorMatrix = new ColorMatrix();
         if (grayscale)
         {
             newColorMatrix.Matrix00 = 0.3333333f;
             newColorMatrix.Matrix01 = 0.3333333f;
             newColorMatrix.Matrix02 = 0.3333333f;
             newColorMatrix.Matrix10 = 0.3333333f;
             newColorMatrix.Matrix11 = 0.3333333f;
             newColorMatrix.Matrix12 = 0.3333333f;
             newColorMatrix.Matrix20 = 0.3333333f;
             newColorMatrix.Matrix21 = 0.3333333f;
             newColorMatrix.Matrix22 = 0.3333333f;
         }
         newColorMatrix.Matrix33 = transparency;
         ImageAttributes imageAttr = new ImageAttributes();
         imageAttr.SetColorMatrix(newColorMatrix);
         graphics.DrawImage(image, destRect, source.X, source.Y, source.Width, source.Height, GraphicsUnit.Pixel, imageAttr);
     }
 }
 public static void DrawImage(Graphics graphics, Image image, Rectangle destination, DesignerContentAlignment alignment)
 {
     if (image == null)
     {
         throw new ArgumentNullException("image");
     }
     DrawImage(graphics, image, destination, new Rectangle(Point.Empty, image.Size), alignment, 1f, false);
 }
 public AmbientTheme(WorkflowTheme theme) : base(theme)
 {
     this.showConfigErrors = true;
     this.dropIndicatorColor = System.Drawing.Color.Green;
     this.selectionForeColor = System.Drawing.Color.Blue;
     this.selectionPatternColor = System.Drawing.Color.DarkGray;
     this.foreColor = System.Drawing.Color.Gray;
     this.backColor = System.Drawing.Color.White;
     this.commentIndicatorColor = System.Drawing.Color.FromArgb(0x31, 0xc6, 0x69);
     this.readonlyIndicatorColor = System.Drawing.Color.Gray;
     this.watermarkAlignment = DesignerContentAlignment.BottomRight;
     this.watermarkImagePath = string.Empty;
     this.gridStyle = DashStyle.Dash;
     this.gridColor = System.Drawing.Color.FromArgb(0xc0, 0xc0, 0xc0);
     this.fontName = WorkflowTheme.GetDefaultFont().FontFamily.Name;
     this.designerStyle = System.Workflow.ComponentModel.Design.DesignerSize.Medium;
     this.drawRounded = true;
     this.showDesignerBorder = true;
 }
Ejemplo n.º 9
0
        internal static Rectangle GetRectangleFromAlignment(DesignerContentAlignment alignment, Rectangle destination, Size size)
        {
            if (size.IsEmpty || destination.IsEmpty)
                return Rectangle.Empty;

            Rectangle rectangle = Rectangle.Empty;
            rectangle.Width = Math.Min(size.Width, destination.Width);
            rectangle.Height = Math.Min(size.Height, destination.Height);

            if ((alignment & DesignerContentAlignment.Fill) > 0)
            {
                rectangle = destination;
            }
            else
            {
                if ((alignment & DesignerContentAlignment.Left) > 0)
                    rectangle.X = destination.Left;
                else if ((alignment & DesignerContentAlignment.Right) > 0)
                    rectangle.X = destination.Right - rectangle.Width;
                else
                    rectangle.X = destination.Left + destination.Width / 2 - rectangle.Width / 2;

                if ((alignment & DesignerContentAlignment.Top) > 0)
                    rectangle.Y = destination.Top;
                else if ((alignment & DesignerContentAlignment.Bottom) > 0)
                    rectangle.Y = destination.Bottom - rectangle.Height;
                else
                    rectangle.Y = destination.Top + destination.Height / 2 - rectangle.Height / 2;
            }

            return rectangle;
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Draws image with specified paramters.
        /// </summary>
        /// <param name="graphics">Graphics on which to draw image</param>
        /// <param name="image">Image to be drawn</param>
        /// <param name="destination">Bounding rectangle for the image</param>
        /// <param name="source">Source rectangle of the image</param>
        /// <param name="alignment">Alignment specifying how image will be aligned against the bounding rectangle</param>
        /// <param name="transparency">Transparency for the image</param>
        /// <param name="grayscale">Value indicating if the image should be gray scaled</param>
        public static void DrawImage(Graphics graphics, Image image, Rectangle destination, Rectangle source, DesignerContentAlignment alignment, float transparency, bool grayscale)
        {
            if (graphics == null)
                throw new ArgumentNullException("graphics");

            if (image == null)
                throw new ArgumentNullException("image");

            if (destination.IsEmpty)
                throw new ArgumentNullException("destination");

            if (source.IsEmpty)
                throw new ArgumentNullException("source");

            if (transparency < 0 || transparency > 1.0f)
                throw new ArgumentNullException("transparency");

            Rectangle imageRectangle = GetRectangleFromAlignment(alignment, destination, source.Size);
            if (image != null && !imageRectangle.IsEmpty)
            {
                ColorMatrix colorMatrix = new ColorMatrix();
                if (grayscale)
                {
                    colorMatrix.Matrix00 = 1 / 3f;
                    colorMatrix.Matrix01 = 1 / 3f;
                    colorMatrix.Matrix02 = 1 / 3f;
                    colorMatrix.Matrix10 = 1 / 3f;
                    colorMatrix.Matrix11 = 1 / 3f;
                    colorMatrix.Matrix12 = 1 / 3f;
                    colorMatrix.Matrix20 = 1 / 3f;
                    colorMatrix.Matrix21 = 1 / 3f;
                    colorMatrix.Matrix22 = 1 / 3f;
                }
                colorMatrix.Matrix33 = transparency; //Alpha factor

                ImageAttributes imageAttributes = new ImageAttributes();
                imageAttributes.SetColorMatrix(colorMatrix);
                graphics.DrawImage(image, imageRectangle, source.X, source.Y, source.Width, source.Height, GraphicsUnit.Pixel, imageAttributes);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Draws image with specified paramters.
        /// </summary>
        /// <param name="graphics">Graphics on which to draw the image</param>
        /// <param name="image">Image to be drawn</param>
        /// <param name="destination">Bounding rectangle for the image</param>
        /// <param name="alignment">Alignment specifying how the image will be aligned against bounding rectangle</param>
        public static void DrawImage(Graphics graphics, Image image, Rectangle destination, DesignerContentAlignment alignment)
        {
            if (image == null)
                throw new ArgumentNullException("image"); //we are accessing .Size property on the "image" argument

            DrawImage(graphics, image, destination, new Rectangle(Point.Empty, image.Size), alignment, 1.0f, false);
        }