public override void Render(Graphics graphics, IRender render)
		{
			byte opacity = 100;
			if (Table != null) opacity = Table.Opacity;

			//Draw indent
			SolidBrush brush = new SolidBrush(render.AdjustColor(Backcolor,1,opacity));
			brush.Color = Color.FromArgb(brush.Color.A /2, brush.Color);
			graphics.FillRectangle(brush,0,Rectangle.Top,Indent,Rectangle.Height);

			//Draw image
			float imageWidth = 0;
			if (Image != null)
			{
				System.Drawing.Image bitmap = Image.Bitmap;

				//Work out position of image
				float imageTop = (Rectangle.Height - bitmap.Height) / 2;
				if (imageTop < 0) imageTop = 0;
				
				imageWidth = bitmap.Width;
				graphics.DrawImageUnscaled(bitmap,Convert.ToInt32(Indent),Convert.ToInt32(Rectangle.Top+imageTop));
			}

			//Draw text
			RectangleF textRectangle = new RectangleF(Indent+imageWidth+4,Rectangle.Top,Rectangle.Width - Indent -4,Rectangle.Height);
			brush = new SolidBrush(render.AdjustColor(Forecolor,1,opacity));
			StringFormat format = new StringFormat();
			format.LineAlignment = StringAlignment.Center;
			format.FormatFlags = StringFormatFlags.NoWrap;
			graphics.DrawString(Text,Component.Instance.GetFont(FontName,FontSize,FontStyle),brush,textRectangle,format);
		}
Beispiel #2
0
        private void RenderPort(Graphics graphics, IRender render)
        {
            GraphicsPath path = GetPathInternal();

            //Create a brush if no custom brush defined
            if (DrawBackground)
            {
                if (CustomBrush == null)
                {
                    //Use a linear gradient brush if gradient requested
                    if (DrawGradient)
                    {
                        LinearGradientBrush brush;
                        brush = new LinearGradientBrush(new RectangleF(0, 0, Rectangle.Width, Rectangle.Height), render.AdjustColor(BackColor, 0, Opacity), render.AdjustColor(GradientColor, 0, Opacity), GradientMode);
                        brush.GammaCorrection = true;
                        if (Blend != null)
                        {
                            brush.Blend = Blend;
                        }
                        graphics.FillPath(brush, path);
                    }
                    //Draw normal solid brush
                    else
                    {
                        SolidBrush brush;
                        brush = new SolidBrush(render.AdjustColor(BackColor, 0, this.Opacity));
                        graphics.FillPath(brush, path);
                    }
                }
                else
                {
                    graphics.FillPath(CustomBrush, path);
                }
            }

            Pen pen = null;

            if (CustomPen == null)
            {
                pen           = new Pen(BorderColor, BorderWidth);
                pen.DashStyle = BorderStyle;

                //Check if winforms renderer and adjust color as required
                pen.Color = render.AdjustColor(BorderColor, BorderWidth, Opacity);
            }
            else
            {
                pen = CustomPen;
            }

            graphics.SmoothingMode = SmoothingMode;
            graphics.DrawPath(pen, path);

            //Render internal rectangle
            //Pen tempPen = new Pen(Color.Red,2);
            //graphics.DrawRectangle(tempPen,mInternalRectangle.X,mInternalRectangle.Y,mInternalRectangle.Width,mInternalRectangle.Height);
        }
        public override void Render(Graphics graphics, IRender render)
        {
            byte opacity = 100;

            if (Table != null)
            {
                opacity = Table.Opacity;
            }

            //Draw Background
            SolidBrush brush = new SolidBrush(render.AdjustColor(Backcolor, 1, opacity));

            brush.Color = Color.FromArgb(brush.Color.A / 2, brush.Color);

            graphics.FillRectangle(brush, Rectangle);

            //Draw plus or minus rectangle
            SmoothingMode smoothing = graphics.SmoothingMode;

            graphics.SmoothingMode = SmoothingMode.HighQuality;
            RectangleF          expander      = new RectangleF(4 + Indent, Rectangle.Top + 4, 11, 11);
            LinearGradientBrush gradientBrush = new LinearGradientBrush(expander, Color.FromArgb(255, Color.White), Color.FromArgb(255, 166, 176, 185), LinearGradientMode.Vertical);

            graphics.FillRectangle(gradientBrush, expander);            // internal
            Pen pen = new Pen(Color.FromArgb(128, Color.Gray), 1);

            graphics.DrawRectangle(pen, expander.X, expander.Y, expander.Width, expander.Height);         //border
            pen.Color = Color.FromArgb(128, Color.Black);
            pen.Width = 2;
            graphics.DrawLine(pen, expander.X + 2, expander.Y + 5.5F, expander.X + 9, expander.Y + 5.5F); //minus
            if (!Expanded)
            {
                graphics.DrawLine(pen, expander.X + 5.5F, expander.Y + 2, expander.X + 5.5F, expander.Y + 9);            //plus
            }
            graphics.SmoothingMode = smoothing;

            //Draw text
            RectangleF textRectangle = new RectangleF(20 + Indent, Rectangle.Top, Rectangle.Width - 20 - Indent, Rectangle.Height);

            brush = new SolidBrush(render.AdjustColor(Forecolor, 1, opacity));
            StringFormat format = new StringFormat();

            format.LineAlignment = StringAlignment.Center;
            format.FormatFlags   = StringFormatFlags.NoWrap;
            graphics.DrawString(Text, Component.Instance.GetFont(FontName, FontSize, FontStyle), brush, textRectangle, format);

            //Draw indent
            //brush = new SolidBrush(render.AdjustColor(Backcolor,1,opacity));
            //brush.Color = Color.FromArgb(brush.Color.A /2, brush.Color);
            //graphics.FillRectangle(brush,0,Rectangle.Top,Indent,Rectangle.Height);
        }
        //fill the marker background
        protected internal override void RenderShadow(Graphics graphics, IRender render)
        {
            Layer layer       = render.CurrentLayer;
            Color shadowColor = render.AdjustColor(layer.ShadowColor, BorderWidth, Opacity);

            if (DrawBackground)
            {
                SolidBrush brush = new SolidBrush(shadowColor);

                //Draw soft shadows
                if (layer.SoftShadows)
                {
                    shadowColor = Color.FromArgb(10, shadowColor);
                    graphics.CompositingQuality = CompositingQuality.HighQuality;
                    graphics.SmoothingMode      = SmoothingMode.HighQuality;
                }

                graphics.FillPath(brush, GetPathInternal());

                if (layer.SoftShadows)
                {
                    graphics.CompositingQuality = render.CompositingQuality;
                    graphics.SmoothingMode      = SmoothingMode;
                }
            }

            base.RenderShadow(graphics, render);
        }
        private void RenderElement(Graphics graphics, IRender render)
        {
            Pen pen = null;

            if (CustomPen == null)
            {
                pen           = new Pen(BorderColor, BorderWidth);
                pen.DashStyle = BorderStyle;

                //Check if winforms renderer and adjust color as required
                pen.Color = render.AdjustColor(BorderColor, BorderWidth, Opacity);
            }
            else
            {
                pen = CustomPen;
            }

            //Can throw an out of memory exception in System.Drawing
            try
            {
                graphics.SmoothingMode = SmoothingMode;
                graphics.DrawPath(pen, mPath);
            }
            catch
            {
            }
        }
        //Implement a base rendering of an element
        protected internal virtual void RenderShadow(Graphics graphics, IRender render)
        {
            if (this.Layer == null)
            {
                return;
            }

            Layer        layer      = Layer;
            Pen          shadowPen  = new Pen(render.AdjustColor(layer.ShadowColor, BorderWidth, Opacity));
            GraphicsPath shadowPath = GetPathInternal();

            graphics.TranslateTransform(layer.ShadowOffset.X, layer.ShadowOffset.Y);

            if (layer.SoftShadows)
            {
                graphics.CompositingQuality = CompositingQuality.HighQuality;
                graphics.SmoothingMode      = SmoothingMode.HighQuality;
                graphics.DrawPath(shadowPen, shadowPath);
                graphics.CompositingQuality = render.CompositingQuality;
                graphics.SmoothingMode      = SmoothingMode;
            }
            else
            {
                graphics.DrawPath(shadowPen, shadowPath);
            }

            //Restore graphics
            graphics.TranslateTransform(-layer.ShadowOffset.X, -layer.ShadowOffset.Y);
        }
        public override void Render(Graphics graphics, IRender render)
        {
            byte opacity = 100;

            if (Table != null)
            {
                opacity = Table.Opacity;
            }

            //Draw indent
            SolidBrush brush = new SolidBrush(render.AdjustColor(Backcolor, 1, opacity));

            brush.Color = Color.FromArgb(brush.Color.A / 2, brush.Color);
            graphics.FillRectangle(brush, 0, Rectangle.Top, Indent, Rectangle.Height);

            //Draw image
            float imageWidth = 0;

            if (Image != null)
            {
                System.Drawing.Image bitmap = Image.Bitmap;

                //Work out position of image
                float imageTop = (Rectangle.Height - bitmap.Height) / 2;
                if (imageTop < 0)
                {
                    imageTop = 0;
                }

                imageWidth = bitmap.Width;
                graphics.DrawImageUnscaled(bitmap, Convert.ToInt32(Indent), Convert.ToInt32(Rectangle.Top + imageTop));
            }

            //Draw text
            RectangleF textRectangle = new RectangleF(Indent + imageWidth + 4, Rectangle.Top, Rectangle.Width - Indent - 4, Rectangle.Height);

            brush = new SolidBrush(render.AdjustColor(Forecolor, 1, opacity));
            StringFormat format = new StringFormat();

            format.LineAlignment = StringAlignment.Center;
            format.FormatFlags   = StringFormatFlags.NoWrap;
            graphics.DrawString(Text, Component.Instance.GetFont(FontName, FontSize, FontStyle), brush, textRectangle, format);
        }
Beispiel #8
0
        //Methods
        public virtual void Render(Graphics graphics, IRender render)
        {
            //Translate by offset
            if (Visible)
            {
                graphics.TranslateTransform(Offset.X, Offset.Y);

                SolidBrush brush = new SolidBrush(render.AdjustColor(Color, 0, Opacity));
                graphics.DrawString(Text, Font, brush, 0, 0);

                graphics.TranslateTransform(-Offset.X, -Offset.Y);
            }
        }
        private void RenderSolid(Graphics graphics, IRender render)
        {
            //Create a brush if no custom brush defined
            if (DrawBackground)
            {
                if (CustomBrush == null)
                {
                    //Use a linear gradient brush if gradient requested
                    if (DrawGradient)
                    {
                        LinearGradientBrush brush;
                        brush = new LinearGradientBrush(new RectangleF(0, 0, Rectangle.Width, Rectangle.Height), render.AdjustColor(BackColor, 0, Opacity), render.AdjustColor(GradientColor, 0, Opacity), mGradientMode);
                        brush.GammaCorrection = true;
                        if (Blend != null)
                        {
                            brush.Blend = Blend;
                        }
                        graphics.FillPath(brush, GetPathInternal());
                    }
                    //Draw normal solid brush
                    else
                    {
                        SolidBrush brush;
                        brush = new SolidBrush(render.AdjustColor(BackColor, 0, this.Opacity));
                        graphics.FillPath(brush, GetPathInternal());
                    }
                }
                else
                {
                    graphics.FillPath(CustomBrush, GetPathInternal());
                }
            }

//			//Render internal rectangle
//			Pen tempPen = new Pen(Color.Red,1);
//			graphics.DrawRectangle(tempPen,mInternalRectangle.X,mInternalRectangle.Y,mInternalRectangle.Width,mInternalRectangle.Height);
//
//			tempPen = new Pen(Color.Green,1);
//			graphics.DrawRectangle(tempPen,mTransformInternalRectangle.X,mTransformInternalRectangle.Y,mTransformInternalRectangle.Width,mTransformInternalRectangle.Height);
        }
        //fill the marker background
        protected internal override void Render(Graphics graphics, IRender render)
        {
            graphics.SmoothingMode = SmoothingMode;
            if (DrawBackground)
            {
                SolidBrush brush;
                brush = new SolidBrush(render.AdjustColor(mBackColor, 0, this.Opacity));
                graphics.FillPath(brush, GetPathInternal());
            }

            base.Render(graphics, render);

            //Draw any images and annotations
            if (Image != null)
            {
                Image.Render(graphics, render);
            }
            if (Label != null)
            {
                Label.Render(graphics, render);
            }
        }
        public virtual void Render(Graphics graphics, RectangleF layout, IRender render)
        {
            //If Offset and Size specified then replace layout
            if (Visible)
            {
                if (!Offset.IsEmpty)
                {
                    layout = new RectangleF(Offset, layout.Size);
                }
                if (!Size.IsEmpty)
                {
                    layout = new RectangleF(layout.Location, Size);
                }

                SolidBrush brush = new SolidBrush(render.AdjustColor(Color, 0, Opacity));
                graphics.DrawString(Text, Font, brush, layout, StringFormat);
            }

            //Render the layout rectangle for testing
            //Pen pen = new Pen(Color.Red);
            //graphics.DrawRectangle(pen,layout.X,layout.Y,layout.Width,layout.Height);
        }
		private void RenderSolid(Graphics graphics,IRender render)
		{
			//Create a brush if no custom brush defined
			if (DrawBackground)
			{
				if (CustomBrush == null)
				{
					//Use a linear gradient brush if gradient requested
					if (DrawGradient)
					{
						LinearGradientBrush brush;
						brush = new LinearGradientBrush(new RectangleF(0,0,Rectangle.Width,Rectangle.Height),render.AdjustColor(BackColor,0,Opacity),render.AdjustColor(GradientColor,0,Opacity),mGradientMode);
						brush.GammaCorrection = true;
						if (Blend != null) brush.Blend = Blend;
						graphics.FillPath(brush, GetPathInternal());
					}
					//Draw normal solid brush
					else
					{
						SolidBrush brush;
						brush = new SolidBrush(render.AdjustColor(BackColor,0,this.Opacity));
						graphics.FillPath(brush,GetPathInternal());
					}
				}
				else	
				{
					graphics.FillPath(CustomBrush, GetPathInternal());
				}
			}

//			//Render internal rectangle
//			Pen tempPen = new Pen(Color.Red,1);
//			graphics.DrawRectangle(tempPen,mInternalRectangle.X,mInternalRectangle.Y,mInternalRectangle.Width,mInternalRectangle.Height);
//
//			tempPen = new Pen(Color.Green,1);
//			graphics.DrawRectangle(tempPen,mTransformInternalRectangle.X,mTransformInternalRectangle.Y,mTransformInternalRectangle.Width,mTransformInternalRectangle.Height);

		}
		protected internal override void RenderShadow(Graphics graphics, IRender render)
		{
			if (DrawBackground)
			{
				if (Layer == null) return;
			
				//Use transformed path as shadows are not rotated
				GraphicsPath shadowPath = Geometry.ScalePath(TransformPath,1F,1F);    

				graphics.TranslateTransform(Layer.ShadowOffset.X ,Layer.ShadowOffset.Y);
				graphics.SmoothingMode = SmoothingMode.AntiAlias;

				//Draw soft shadows
				if (Layer.SoftShadows && StencilItem != null && ((StencilItem.Options & StencilItemOptions.SoftShadow) == StencilItemOptions.SoftShadow))
				{
					PathGradientBrush brush = new PathGradientBrush(shadowPath);

					//Calculate position factor based on 0.3 for 100 pixels
					//0.6 for 50 pixels, 0.15 for 200 pixels
					float factor = Convert.ToSingle(0.3 * (100 / Rectangle.Width));  

					//Set up the brush blend
					Blend blend = new Blend();
					blend.Positions = new float[] {0F,factor,1F};
					blend.Factors = new float[] {0F,0.8F,1F};
					brush.Blend = blend;

					brush.CenterColor = render.AdjustColor(Layer.ShadowColor,1,Opacity);
					//brush.CenterColor = Color.FromArgb(brush.CenterColor.A * 30 / 100,brush.CenterColor);
					brush.SurroundColors = new Color[] {Color.FromArgb(0, Layer.ShadowColor)};
					
					graphics.FillPath(brush, shadowPath);

					brush.Dispose();
				}
				else
				{
					SolidBrush shadowBrush = new SolidBrush(render.AdjustColor(Color.FromArgb(10,Layer.ShadowColor),1,Opacity));
					graphics.FillPath(shadowBrush,shadowPath);
				}

				//Restore graphics
				graphics.TranslateTransform(-Layer.ShadowOffset.X ,-Layer.ShadowOffset.Y);
				graphics.SmoothingMode = SmoothingMode;
			}
			else
			{
				if (DrawBorder) 
				{

					if (this.Layer == null) return;
			
					Layer layer = Layer;
					Pen shadowPen = new Pen(render.AdjustColor(layer.ShadowColor,BorderWidth,Opacity));
					GraphicsPath shadowPath = TransformPath;
			
					graphics.TranslateTransform(layer.ShadowOffset.X ,layer.ShadowOffset.Y);
			
					if (layer.SoftShadows)
					{
						graphics.CompositingQuality = CompositingQuality.HighQuality;
						graphics.SmoothingMode = SmoothingMode.HighQuality;
						graphics.DrawPath(shadowPen,shadowPath);
						graphics.CompositingQuality = render.CompositingQuality;
						graphics.SmoothingMode = SmoothingMode;
					}
					else
					{
						graphics.DrawPath(shadowPen,shadowPath);
					}

					//Restore graphics
					graphics.TranslateTransform(-layer.ShadowOffset.X ,-layer.ShadowOffset.Y);
				}
			}
		}
		protected internal override void RenderShadow(Graphics graphics, IRender render)
		{
			if (Points == null) return;

			PointF location;
			PointF reference;
			Segment segment = null;

			Layer layer = this.Layer;
			Pen shadowPen = new Pen(layer.ShadowColor);
			GraphicsPath shadowPath = GetPathInternal();
			shadowPen.Color = render.AdjustColor(layer.ShadowColor,0,this.Opacity);

			//Save the current region
			Region current = graphics.Clip;

			//Mask out each marker
			for (int i=0;i<Points.Count-1;i++)
			{
				location = (PointF) Points[i];
				reference = (PointF) Points[i+1];

				segment = Segments[i];
				
				//Mask out the start marker
				if (segment.Start.Marker != null)
				{
					Region region = new Region(segment.Start.Marker.GetPathInternal());
					region.Transform(GetMarkerTransform(segment.Start.Marker,location,reference,new Matrix()));
					region.Translate(layer.ShadowOffset.X ,layer.ShadowOffset.Y);
					graphics.SetClip(region,CombineMode.Exclude);
				}
			}

			//Mask out final marker
			if (segment.End.Marker != null)
			{
				location = (PointF) Points[Points.Count-1];
				reference = (PointF) Points[Points.Count-2];

				Region region = new Region(segment.End.Marker.GetPathInternal());
				region.Transform(GetMarkerTransform(segment.End.Marker,location,reference,new Matrix()));
				region.Translate(layer.ShadowOffset.X ,layer.ShadowOffset.Y);
				graphics.SetClip(region,CombineMode.Exclude);
			}
			
			//Draw the path
			graphics.TranslateTransform(layer.ShadowOffset.X ,layer.ShadowOffset.Y);
			graphics.DrawPath(shadowPen,shadowPath);

			//Reset the clip
			graphics.Clip = current;

			//Render the markers
			for (int i=0;i<Points.Count-1;i++)
			{
				segment = Segments[i];
				location = (PointF) Points[i];
				reference = (PointF) Points[i+1];

				if (segment.Start.Marker != null) RenderMarkerShadow(segment.Start.Marker,location,reference,graphics,render);
			}

			//Render final marker
			if (segment.End.Marker != null)
			{
				location = (PointF) Points[Points.Count-1];
				reference = (PointF) Points[Points.Count-2];
				RenderMarkerShadow(segment.End.Marker,location,reference,graphics,render);				
			}

			graphics.TranslateTransform(-layer.ShadowOffset.X ,-layer.ShadowOffset.Y);
		}
Beispiel #15
0
		//Implement a base rendering of an element
		protected internal override void RenderShadow(Graphics graphics,IRender render)
		{
			if (mPoints == null) return;
			if (mPoints.Count < 2) return;

			PointF startLocation = (PointF) mPoints[0];
			PointF startReference = (PointF) mPoints[1];
			PointF endLocation = (PointF) mPoints[mPoints.Count-1];
			PointF endReference = (PointF) mPoints[mPoints.Count-2];

			Layer layer = this.Layer;
			Pen shadowPen = new Pen(layer.ShadowColor);
			GraphicsPath shadowPath = GetPathInternal();
			shadowPen.Color = render.AdjustColor(layer.ShadowColor,0,this.Opacity);

			//Save the current region
			Region current = graphics.Clip;

			//Mask out the start marker
			if (Start.Marker != null)
			{
				Region region = new Region(Start.Marker.GetPathInternal());
				region.Transform(GetMarkerTransform(Start.Marker,startLocation,startReference,new Matrix()));
				region.Translate(layer.ShadowOffset.X ,layer.ShadowOffset.Y);
				graphics.SetClip(region,CombineMode.Exclude);
			}
			
			//Mask out the end marker
			if (End.Marker != null)
			{
				Region region = new Region(End.Marker.GetPathInternal());
				region.Transform(GetMarkerTransform(End.Marker,endLocation,endReference,new Matrix()));
				region.Translate(layer.ShadowOffset.X ,layer.ShadowOffset.Y);
				graphics.SetClip(region,CombineMode.Exclude);
			}

			graphics.TranslateTransform(layer.ShadowOffset.X ,layer.ShadowOffset.Y);
			
			//Draw line
			if (Layer.SoftShadows)
			{
				shadowPen.Color = Color.FromArgb(20,shadowPen.Color);
				graphics.CompositingQuality = CompositingQuality.HighQuality;
				graphics.SmoothingMode = SmoothingMode.HighQuality;
			}

			graphics.DrawPath(shadowPen, shadowPath);

			if (layer.SoftShadows)
			{
				graphics.CompositingQuality = render.CompositingQuality;
				graphics.SmoothingMode = SmoothingMode;
			}

			//Restore graphics
			if (Start.Marker != null || End.Marker != null)
			{
				graphics.Clip = current;
				if (Start.Marker != null) RenderMarkerShadow(Start.Marker,startLocation,startReference,graphics,render);
				if (End.Marker != null) RenderMarkerShadow(End.Marker,endLocation,endReference,graphics,render);
			}

			graphics.TranslateTransform(-layer.ShadowOffset.X ,-layer.ShadowOffset.Y);
		}
		//fill the marker background
		protected internal override void Render(Graphics graphics, IRender render)
		{
			graphics.SmoothingMode = SmoothingMode;
			if (DrawBackground)
			{
				SolidBrush brush;
				brush = new SolidBrush(render.AdjustColor(mBackColor,0,this.Opacity));
				graphics.FillPath(brush,GetPathInternal());
			}
			
			base.Render (graphics, render);

			//Draw any images and annotations
			if (Image != null) Image.Render(graphics,render);
			if (Label != null) Label.Render(graphics,render);
		}
		protected internal override void RenderAction(Graphics graphics,IRender render,IRenderDesign renderDesign)
		{
			if (Points == null) return;

			PointF location;
			PointF reference;
			Segment segment = null;

			//Save the current region
			Region current = graphics.Clip;

			//Mask out each marker
			for (int i=0; i<Points.Count-1; i++)
			{
				location = (PointF) Points[i];
				reference = (PointF) Points[i+1];

				segment = Segments[i];
				
				//Mask out the start marker
				if (segment.Start.Marker != null)
				{
					Region region = new Region(segment.Start.Marker.GetPathInternal());
					region.Transform(GetMarkerTransform(segment.Start.Marker,location,reference,new Matrix()));
					graphics.SetClip(region,CombineMode.Exclude);
				}
			}

			//Mask out final marker
			if (segment.End.Marker != null)
			{
				location = (PointF) Points[Points.Count-1];
				reference = (PointF) Points[Points.Count-2];

				Region region = new Region(segment.End.Marker.GetPathInternal());
				region.Transform(GetMarkerTransform(segment.End.Marker,location,reference,new Matrix()));
				graphics.SetClip(region,CombineMode.Exclude);
			}
			
			//Draw the path
			GraphicsPath path = GetPathInternal();
			if (path == null) return;

			if (renderDesign.ActionStyle == ActionStyle.Default)
			{
				Pen pen = new Pen(render.AdjustColor(BorderColor,BorderWidth,Opacity));
				pen.Width = BorderWidth;
				graphics.DrawPath(pen,path);
			}
			else
			{
				graphics.DrawPath(Component.Instance.ActionPen,path);
			}

			//Reset the clip
			graphics.Clip = current;

			//Render the markers
			for (int i=0;i<Points.Count-1;i++)
			{
				segment = Segments[i];
				location = (PointF) Points[i];
				reference = (PointF) Points[i+1];

				if (segment.Start.Marker != null) RenderMarkerAction(segment.Start.Marker,location,reference,graphics,render,renderDesign);
			}

			//Render final marker
			if (segment.End.Marker != null)
			{
				location = (PointF) Points[Points.Count-1];
				reference = (PointF) Points[Points.Count-2];
				RenderMarkerAction(segment.End.Marker,location,reference,graphics,render,renderDesign);				
			}
		}
        protected internal override void RenderShadow(Graphics graphics, IRender render)
        {
            if (DrawBackground)
            {
                if (Layer == null)
                {
                    return;
                }

                //Use transformed path as shadows are not rotated
                GraphicsPath shadowPath = Geometry.ScalePath(TransformPath, 1F, 1F);

                graphics.TranslateTransform(Layer.ShadowOffset.X, Layer.ShadowOffset.Y);
                graphics.SmoothingMode = SmoothingMode.AntiAlias;

                //Draw soft shadows
                if (Layer.SoftShadows && StencilItem != null && ((StencilItem.Options & StencilItemOptions.SoftShadow) == StencilItemOptions.SoftShadow))
                {
                    PathGradientBrush brush = new PathGradientBrush(shadowPath);

                    //Calculate position factor based on 0.3 for 100 pixels
                    //0.6 for 50 pixels, 0.15 for 200 pixels
                    float factor = Convert.ToSingle(0.3 * (100 / Rectangle.Width));

                    //Set up the brush blend
                    Blend blend = new Blend();
                    blend.Positions = new float[] { 0F, factor, 1F };
                    blend.Factors   = new float[] { 0F, 0.8F, 1F };
                    brush.Blend     = blend;

                    brush.CenterColor = render.AdjustColor(Layer.ShadowColor, 1, Opacity);
                    //brush.CenterColor = Color.FromArgb(brush.CenterColor.A * 30 / 100,brush.CenterColor);
                    brush.SurroundColors = new Color[] { Color.FromArgb(0, Layer.ShadowColor) };

                    graphics.FillPath(brush, shadowPath);

                    brush.Dispose();
                }
                else
                {
                    SolidBrush shadowBrush = new SolidBrush(render.AdjustColor(Color.FromArgb(10, Layer.ShadowColor), 1, Opacity));
                    graphics.FillPath(shadowBrush, shadowPath);
                }

                //Restore graphics
                graphics.TranslateTransform(-Layer.ShadowOffset.X, -Layer.ShadowOffset.Y);
                graphics.SmoothingMode = SmoothingMode;
            }
            else
            {
                if (DrawBorder)
                {
                    if (this.Layer == null)
                    {
                        return;
                    }

                    Layer        layer      = Layer;
                    Pen          shadowPen  = new Pen(render.AdjustColor(layer.ShadowColor, BorderWidth, Opacity));
                    GraphicsPath shadowPath = TransformPath;

                    graphics.TranslateTransform(layer.ShadowOffset.X, layer.ShadowOffset.Y);

                    if (layer.SoftShadows)
                    {
                        graphics.CompositingQuality = CompositingQuality.HighQuality;
                        graphics.SmoothingMode      = SmoothingMode.HighQuality;
                        graphics.DrawPath(shadowPen, shadowPath);
                        graphics.CompositingQuality = render.CompositingQuality;
                        graphics.SmoothingMode      = SmoothingMode;
                    }
                    else
                    {
                        graphics.DrawPath(shadowPen, shadowPath);
                    }

                    //Restore graphics
                    graphics.TranslateTransform(-layer.ShadowOffset.X, -layer.ShadowOffset.Y);
                }
            }
        }
Beispiel #19
0
		//Methods
		public virtual void Render(Graphics graphics,IRender render)
		{
			//Translate by offset
			if (Visible)
			{
				graphics.TranslateTransform(Offset.X,Offset.Y);

				SolidBrush brush = new SolidBrush(render.AdjustColor(Color,0,Opacity));
				graphics.DrawString(Text,Font,brush,0,0);

				graphics.TranslateTransform(-Offset.X,-Offset.Y);
			}
		}
Beispiel #20
0
		//Implement a base rendering of an element
		protected internal virtual void RenderShadow(Graphics graphics,IRender render)
		{
			if (this.Layer == null) return;
			
			Layer layer = Layer;
			Pen shadowPen = new Pen(render.AdjustColor(layer.ShadowColor,BorderWidth,Opacity));
			GraphicsPath shadowPath = GetPathInternal();
			
			graphics.TranslateTransform(layer.ShadowOffset.X ,layer.ShadowOffset.Y);
			
			if (layer.SoftShadows)
			{
				graphics.CompositingQuality = CompositingQuality.HighQuality;
				graphics.SmoothingMode = SmoothingMode.HighQuality;
				graphics.DrawPath(shadowPen,shadowPath);
				graphics.CompositingQuality = render.CompositingQuality;
				graphics.SmoothingMode = SmoothingMode;
			}
			else
			{
				graphics.DrawPath(shadowPen,shadowPath);
			}

			//Restore graphics
			graphics.TranslateTransform(-layer.ShadowOffset.X ,-layer.ShadowOffset.Y);
		}
		public virtual void Render(Graphics graphics, RectangleF layout, IRender render)
		{
			//If Offset and Size specified then replace layout
			if (Visible)
			{
				if (!Offset.IsEmpty) layout = new RectangleF(Offset,layout.Size);
				if (!Size.IsEmpty) layout = new RectangleF(layout.Location,Size);

				SolidBrush brush = new SolidBrush(render.AdjustColor(Color,0,Opacity));
				graphics.DrawString(Text,Font,brush,layout,StringFormat);
			}

			//Render the layout rectangle for testing
			//Pen pen = new Pen(Color.Red);
			//graphics.DrawRectangle(pen,layout.X,layout.Y,layout.Width,layout.Height);
		}
Beispiel #22
0
		private void RenderElement(Graphics graphics,IRender render)
		{
			Pen pen = null;

			if (CustomPen == null)
			{
				pen = new Pen(BorderColor,BorderWidth);
				pen.DashStyle = BorderStyle;
				
				//Check if winforms renderer and adjust color as required
				pen.Color = render.AdjustColor(BorderColor,BorderWidth,Opacity);
			}
			else	
			{
				pen = CustomPen;
			}
			
			//Can throw an out of memory exception in System.Drawing
			try
			{				
				graphics.SmoothingMode = SmoothingMode;
				graphics.DrawPath(pen, mPath);
			}
			catch
			{
				
			}
		}
		public override void Render(Graphics graphics, IRender render)
		{
			byte opacity = 100;
			if (Table != null) opacity = Table.Opacity;

			//Draw Background
			SolidBrush brush = new SolidBrush(render.AdjustColor(Backcolor,1,opacity));
			brush.Color = Color.FromArgb(brush.Color.A /2, brush.Color);
		
			graphics.FillRectangle(brush,Rectangle);
			
			//Draw plus or minus rectangle
			SmoothingMode smoothing = graphics.SmoothingMode;
			graphics.SmoothingMode = SmoothingMode.HighQuality;
			RectangleF expander = new RectangleF(4 + Indent, Rectangle.Top + 4,11,11);
			LinearGradientBrush gradientBrush = new LinearGradientBrush(expander,Color.FromArgb(255,Color.White),Color.FromArgb(255,166,176,185),LinearGradientMode.Vertical);
			graphics.FillRectangle(gradientBrush,expander); // internal
			Pen pen = new Pen(Color.FromArgb(128,Color.Gray),1);
			graphics.DrawRectangle(pen,expander.X,expander.Y,expander.Width,expander.Height); //border
			pen.Color = Color.FromArgb(128,Color.Black);
			pen.Width = 2;
			graphics.DrawLine(pen,expander.X+2,expander.Y+5.5F,expander.X+9,expander.Y+5.5F); //minus
			if (!Expanded) graphics.DrawLine(pen,expander.X+5.5F,expander.Y+2,expander.X+5.5F,expander.Y+9); //plus
			graphics.SmoothingMode = smoothing;

			//Draw text
			RectangleF textRectangle = new RectangleF(20 + Indent,Rectangle.Top,Rectangle.Width - 20 - Indent,Rectangle.Height);
			brush = new SolidBrush(render.AdjustColor(Forecolor,1,opacity));
			StringFormat format = new StringFormat();
			format.LineAlignment = StringAlignment.Center;
			format.FormatFlags = StringFormatFlags.NoWrap;
			graphics.DrawString(Text,Component.Instance.GetFont(FontName,FontSize,FontStyle),brush,textRectangle,format);

			//Draw indent
			//brush = new SolidBrush(render.AdjustColor(Backcolor,1,opacity));
			//brush.Color = Color.FromArgb(brush.Color.A /2, brush.Color);
			//graphics.FillRectangle(brush,0,Rectangle.Top,Indent,Rectangle.Height);
		}
		//fill the marker background
		protected internal override void RenderShadow(Graphics graphics, IRender render)
		{
			Layer layer = render.CurrentLayer;
			Color shadowColor = render.AdjustColor(layer.ShadowColor,BorderWidth,Opacity);
			
			if (DrawBackground)
			{
				SolidBrush brush = new SolidBrush(shadowColor);
				
				//Draw soft shadows
				if (layer.SoftShadows) 
				{
					shadowColor = Color.FromArgb(10,shadowColor);
					graphics.CompositingQuality = CompositingQuality.HighQuality;
					graphics.SmoothingMode = SmoothingMode.HighQuality;
				}

				graphics.FillPath(brush,GetPathInternal());
				
				if (layer.SoftShadows)
				{
					graphics.CompositingQuality = render.CompositingQuality;
					graphics.SmoothingMode = SmoothingMode;
				}
			}

			base.RenderShadow(graphics,render);
		}
Beispiel #25
0
		private void RenderTable(Graphics graphics, IRender render)
		{
			GraphicsPath path = GetPathInternal();
			if (path == null) return;

			//Draw background
			Color backColor = render.AdjustColor(BackColor,0,Opacity);
			Color gradientColor = render.AdjustColor(GradientColor,0,Opacity);
			SolidBrush brush = new SolidBrush(backColor);
			graphics.FillPath(brush,path);

			Region current = graphics.Clip;
			Region region = new Region(GetPathInternal());
			graphics.SetClip(region,CombineMode.Intersect);

			//Draw Heading
			RectangleF headingRect = new RectangleF(0,0,Width,HeadingHeight);
			LinearGradientBrush gradient = new LinearGradientBrush(headingRect,gradientColor,backColor,LinearGradientMode.Horizontal);
			graphics.FillRectangle(gradient,headingRect);
			
			//Draw Heading text
			brush.Color = render.AdjustColor(Forecolor,1,Opacity);
			graphics.DrawString(Heading,Component.Instance.GetFont(FontName,FontSize,FontStyle.Bold),brush,8,5);
			graphics.DrawString(SubHeading,Component.Instance.GetFont(FontName,FontSize-1,FontStyle.Regular),brush,8,20);			
			
			if (Expanded)
			{
				float iHeight = HeadingHeight;

				//Draw the top level rows (if any)
				if (Rows.Count > 0)
				{
					brush.Color = GradientColor;
					graphics.FillRectangle(brush,0,iHeight,Indent,1);
					iHeight+=1;
			
					RenderTableRows(graphics,render,Rows,ref iHeight);
				}
			
				if (Groups.Count > 0)
				{
					foreach (TableGroup tableGroup in Groups)
					{
						iHeight+=1;
						tableGroup.SuspendEvents = true;

						tableGroup.SetRectangle(new RectangleF(0,iHeight,Width,RowHeight));
						tableGroup.Render(graphics,render);
						iHeight+=RowHeight;

						tableGroup.SuspendEvents = false;

						if (tableGroup.Groups.Count > 0 && tableGroup.Expanded) RenderTableGroups(graphics, render, tableGroup.Groups, ref iHeight);
						if (tableGroup.Rows.Count > 0 && tableGroup.Expanded) RenderTableRows(graphics, render, tableGroup.Rows, ref iHeight);
					}
				}

				//Render highlight (if any)
				if (DrawSelectedItem && SelectedItem != null) SelectedItem.RenderSelection(graphics,render);
			}

			graphics.Clip = current;

			//Draw outline
			Pen pen;
			if (CustomPen == null)
			{
				pen = new Pen(BorderColor,BorderWidth);
				pen.DashStyle = BorderStyle;
	
				//Check if winforms renderer and adjust color as required
				pen.Color = render.AdjustColor(BorderColor,BorderWidth,Opacity);
			}
			else	
			{
				pen = CustomPen;
			}
			graphics.DrawPath(pen,path);
		}
		protected internal override void Render(Graphics graphics, IRender render)
		{
			if (Points == null) return;

			PointF location;
			PointF reference;
			Segment segment = null;

			//Save the current region
			Region current = graphics.Clip;

			//Mask out each marker
			for (int i=0;i<Points.Count-1;i++)
			{
				location = (PointF) Points[i];
				reference = (PointF) Points[i+1];

				segment = Segments[i];
				
				//Mask out the start marker
				if (segment.Start.Marker != null && !segment.Start.Marker.DrawBackground)
				{
					Region region = new Region(segment.Start.Marker.GetPathInternal());
					region.Transform(GetMarkerTransform(segment.Start.Marker,location,reference,new Matrix()));
					graphics.SetClip(region,CombineMode.Exclude);
				}
			}

			//Mask out final marker
			if (segment.End.Marker != null && !segment.End.Marker.DrawBackground)
			{
				location = (PointF) Points[Points.Count-1];
				reference = (PointF) Points[Points.Count-2];

				Region region = new Region(segment.End.Marker.GetPathInternal());
				region.Transform(GetMarkerTransform(segment.End.Marker,location,reference,new Matrix()));
				graphics.SetClip(region,CombineMode.Exclude);
			}
			
			//Draw the path
			Pen pen = null;

			if (CustomPen == null)
			{
				pen = new Pen(BorderColor,BorderWidth);
				pen.DashStyle = BorderStyle;
	
				//Check if winforms renderer and ajdust color as required
				pen.Color = render.AdjustColor(BorderColor,BorderWidth,Opacity);
			}
			else	
			{
				pen = CustomPen;
			}
			graphics.DrawPath(pen,GetPathInternal());
			
			//Reset the clip
			graphics.Clip = current;

			//Render the segment items
			for (int i=0;i<Points.Count-1;i++)
			{
				segment = Segments[i];
				location = (PointF) Points[i];
				reference = (PointF) Points[i+1];

				if (segment.Start.Marker != null) RenderMarker(segment.Start.Marker,location,reference,graphics,render);

				//Render the segment image and annotation
				RenderSegment(segment,location,reference,graphics,render);
			}

			//Render final marker
			if (segment.End.Marker != null)
			{
				location = (PointF) Points[Points.Count-1];
				reference = (PointF) Points[Points.Count-2];
				RenderMarker(segment.End.Marker,location,reference,graphics,render);				
			}

		}
        protected internal override void Render(Graphics graphics, IRender render)
        {
            if (Points == null)
            {
                return;
            }

            PointF  location;
            PointF  reference;
            Segment segment = null;

            //Save the current region
            Region current = graphics.Clip;

            //Mask out each marker
            for (int i = 0; i < Points.Count - 1; i++)
            {
                location  = (PointF)Points[i];
                reference = (PointF)Points[i + 1];

                segment = Segments[i];

                //Mask out the start marker
                if (segment.Start.Marker != null && !segment.Start.Marker.DrawBackground)
                {
                    Region region = new Region(segment.Start.Marker.GetPathInternal());
                    region.Transform(GetMarkerTransform(segment.Start.Marker, location, reference, new Matrix()));
                    graphics.SetClip(region, CombineMode.Exclude);
                }
            }

            //Mask out final marker
            if (segment.End.Marker != null && !segment.End.Marker.DrawBackground)
            {
                location  = (PointF)Points[Points.Count - 1];
                reference = (PointF)Points[Points.Count - 2];

                Region region = new Region(segment.End.Marker.GetPathInternal());
                region.Transform(GetMarkerTransform(segment.End.Marker, location, reference, new Matrix()));
                graphics.SetClip(region, CombineMode.Exclude);
            }

            //Draw the path
            Pen pen = null;

            if (CustomPen == null)
            {
                pen           = new Pen(BorderColor, BorderWidth);
                pen.DashStyle = BorderStyle;

                //Check if winforms renderer and ajdust color as required
                pen.Color = render.AdjustColor(BorderColor, BorderWidth, Opacity);
            }
            else
            {
                pen = CustomPen;
            }
            graphics.DrawPath(pen, GetPathInternal());

            //Reset the clip
            graphics.Clip = current;

            //Render the segment items
            for (int i = 0; i < Points.Count - 1; i++)
            {
                segment   = Segments[i];
                location  = (PointF)Points[i];
                reference = (PointF)Points[i + 1];

                if (segment.Start.Marker != null)
                {
                    RenderMarker(segment.Start.Marker, location, reference, graphics, render);
                }

                //Render the segment image and annotation
                RenderSegment(segment, location, reference, graphics, render);
            }

            //Render final marker
            if (segment.End.Marker != null)
            {
                location  = (PointF)Points[Points.Count - 1];
                reference = (PointF)Points[Points.Count - 2];
                RenderMarker(segment.End.Marker, location, reference, graphics, render);
            }
        }
Beispiel #28
0
        private void RenderTable(Graphics graphics, IRender render)
        {
            GraphicsPath path = GetPathInternal();

            if (path == null)
            {
                return;
            }

            //Draw background
            Color      backColor     = render.AdjustColor(BackColor, 0, Opacity);
            Color      gradientColor = render.AdjustColor(GradientColor, 0, Opacity);
            SolidBrush brush         = new SolidBrush(backColor);

            graphics.FillPath(brush, path);

            Region current = graphics.Clip;
            Region region  = new Region(GetPathInternal());

            graphics.SetClip(region, CombineMode.Intersect);

            //Draw Heading
            RectangleF          headingRect = new RectangleF(0, 0, Width, HeadingHeight);
            LinearGradientBrush gradient    = new LinearGradientBrush(headingRect, gradientColor, backColor, LinearGradientMode.Horizontal);

            graphics.FillRectangle(gradient, headingRect);

            //Draw Heading text
            brush.Color = render.AdjustColor(Forecolor, 1, Opacity);
            graphics.DrawString(Heading, Component.Instance.GetFont(FontName, FontSize, FontStyle.Bold), brush, 8, 5);
            graphics.DrawString(SubHeading, Component.Instance.GetFont(FontName, FontSize - 1, FontStyle.Regular), brush, 8, 20);

            if (Expanded)
            {
                float iHeight = HeadingHeight;

                //Draw the top level rows (if any)
                if (Rows.Count > 0)
                {
                    brush.Color = GradientColor;
                    graphics.FillRectangle(brush, 0, iHeight, Indent, 1);
                    iHeight += 1;

                    RenderTableRows(graphics, render, Rows, ref iHeight);
                }

                if (Groups.Count > 0)
                {
                    foreach (TableGroup tableGroup in Groups)
                    {
                        iHeight += 1;
                        tableGroup.SuspendEvents = true;

                        tableGroup.SetRectangle(new RectangleF(0, iHeight, Width, RowHeight));
                        tableGroup.Render(graphics, render);
                        iHeight += RowHeight;

                        tableGroup.SuspendEvents = false;

                        if (tableGroup.Groups.Count > 0 && tableGroup.Expanded)
                        {
                            RenderTableGroups(graphics, render, tableGroup.Groups, ref iHeight);
                        }
                        if (tableGroup.Rows.Count > 0 && tableGroup.Expanded)
                        {
                            RenderTableRows(graphics, render, tableGroup.Rows, ref iHeight);
                        }
                    }
                }

                //Render highlight (if any)
                if (DrawSelectedItem && SelectedItem != null)
                {
                    SelectedItem.RenderSelection(graphics, render);
                }
            }

            graphics.Clip = current;

            //Draw outline
            Pen pen;

            if (CustomPen == null)
            {
                pen           = new Pen(BorderColor, BorderWidth);
                pen.DashStyle = BorderStyle;

                //Check if winforms renderer and adjust color as required
                pen.Color = render.AdjustColor(BorderColor, BorderWidth, Opacity);
            }
            else
            {
                pen = CustomPen;
            }
            graphics.DrawPath(pen, path);
        }
        protected internal override void RenderAction(Graphics graphics, IRender render, IRenderDesign renderDesign)
        {
            if (Points == null)
            {
                return;
            }

            PointF  location;
            PointF  reference;
            Segment segment = null;

            //Save the current region
            Region current = graphics.Clip;

            //Mask out each marker
            for (int i = 0; i < Points.Count - 1; i++)
            {
                location  = (PointF)Points[i];
                reference = (PointF)Points[i + 1];

                segment = Segments[i];

                //Mask out the start marker
                if (segment.Start.Marker != null)
                {
                    Region region = new Region(segment.Start.Marker.GetPathInternal());
                    region.Transform(GetMarkerTransform(segment.Start.Marker, location, reference, new Matrix()));
                    graphics.SetClip(region, CombineMode.Exclude);
                }
            }

            //Mask out final marker
            if (segment.End.Marker != null)
            {
                location  = (PointF)Points[Points.Count - 1];
                reference = (PointF)Points[Points.Count - 2];

                Region region = new Region(segment.End.Marker.GetPathInternal());
                region.Transform(GetMarkerTransform(segment.End.Marker, location, reference, new Matrix()));
                graphics.SetClip(region, CombineMode.Exclude);
            }

            //Draw the path
            GraphicsPath path = GetPathInternal();

            if (path == null)
            {
                return;
            }

            if (renderDesign.ActionStyle == ActionStyle.Default)
            {
                Pen pen = new Pen(render.AdjustColor(BorderColor, BorderWidth, Opacity));
                pen.Width = BorderWidth;
                graphics.DrawPath(pen, path);
            }
            else
            {
                graphics.DrawPath(Component.Instance.ActionPen, path);
            }

            //Reset the clip
            graphics.Clip = current;

            //Render the markers
            for (int i = 0; i < Points.Count - 1; i++)
            {
                segment   = Segments[i];
                location  = (PointF)Points[i];
                reference = (PointF)Points[i + 1];

                if (segment.Start.Marker != null)
                {
                    RenderMarkerAction(segment.Start.Marker, location, reference, graphics, render, renderDesign);
                }
            }

            //Render final marker
            if (segment.End.Marker != null)
            {
                location  = (PointF)Points[Points.Count - 1];
                reference = (PointF)Points[Points.Count - 2];
                RenderMarkerAction(segment.End.Marker, location, reference, graphics, render, renderDesign);
            }
        }
        protected internal override void RenderShadow(Graphics graphics, IRender render)
        {
            if (Points == null)
            {
                return;
            }

            PointF  location;
            PointF  reference;
            Segment segment = null;

            Layer        layer      = this.Layer;
            Pen          shadowPen  = new Pen(layer.ShadowColor);
            GraphicsPath shadowPath = GetPathInternal();

            shadowPen.Color = render.AdjustColor(layer.ShadowColor, 0, this.Opacity);

            //Save the current region
            Region current = graphics.Clip;

            //Mask out each marker
            for (int i = 0; i < Points.Count - 1; i++)
            {
                location  = (PointF)Points[i];
                reference = (PointF)Points[i + 1];

                segment = Segments[i];

                //Mask out the start marker
                if (segment.Start.Marker != null)
                {
                    Region region = new Region(segment.Start.Marker.GetPathInternal());
                    region.Transform(GetMarkerTransform(segment.Start.Marker, location, reference, new Matrix()));
                    region.Translate(layer.ShadowOffset.X, layer.ShadowOffset.Y);
                    graphics.SetClip(region, CombineMode.Exclude);
                }
            }

            //Mask out final marker
            if (segment.End.Marker != null)
            {
                location  = (PointF)Points[Points.Count - 1];
                reference = (PointF)Points[Points.Count - 2];

                Region region = new Region(segment.End.Marker.GetPathInternal());
                region.Transform(GetMarkerTransform(segment.End.Marker, location, reference, new Matrix()));
                region.Translate(layer.ShadowOffset.X, layer.ShadowOffset.Y);
                graphics.SetClip(region, CombineMode.Exclude);
            }

            //Draw the path
            graphics.TranslateTransform(layer.ShadowOffset.X, layer.ShadowOffset.Y);
            graphics.DrawPath(shadowPen, shadowPath);

            //Reset the clip
            graphics.Clip = current;

            //Render the markers
            for (int i = 0; i < Points.Count - 1; i++)
            {
                segment   = Segments[i];
                location  = (PointF)Points[i];
                reference = (PointF)Points[i + 1];

                if (segment.Start.Marker != null)
                {
                    RenderMarkerShadow(segment.Start.Marker, location, reference, graphics, render);
                }
            }

            //Render final marker
            if (segment.End.Marker != null)
            {
                location  = (PointF)Points[Points.Count - 1];
                reference = (PointF)Points[Points.Count - 2];
                RenderMarkerShadow(segment.End.Marker, location, reference, graphics, render);
            }

            graphics.TranslateTransform(-layer.ShadowOffset.X, -layer.ShadowOffset.Y);
        }
Beispiel #31
0
		private void RenderPort(Graphics graphics,IRender render)
		{
			GraphicsPath path = GetPathInternal();

			//Create a brush if no custom brush defined
			if (DrawBackground)
			{
				if (CustomBrush == null)
				{
					//Use a linear gradient brush if gradient requested
					if (DrawGradient)
					{
						LinearGradientBrush brush;
						brush = new LinearGradientBrush(new RectangleF(0,0,Rectangle.Width,Rectangle.Height),render.AdjustColor(BackColor,0,Opacity),render.AdjustColor(GradientColor,0,Opacity),GradientMode);
						brush.GammaCorrection = true;
						if (Blend != null) brush.Blend = Blend;
						graphics.FillPath(brush, path);
					}
						//Draw normal solid brush
					else
					{
						SolidBrush brush;
						brush = new SolidBrush(render.AdjustColor(BackColor,0,this.Opacity));
						graphics.FillPath(brush,path);
					}
				}
				else	
				{
					graphics.FillPath(CustomBrush, path);
				}
			}

			Pen pen = null;

			if (CustomPen == null)
			{
				pen = new Pen(BorderColor,BorderWidth);
				pen.DashStyle = BorderStyle;
				
				//Check if winforms renderer and adjust color as required
				pen.Color = render.AdjustColor(BorderColor,BorderWidth,Opacity);
			}
			else	
			{
				pen = CustomPen;
			}
			
			graphics.SmoothingMode = SmoothingMode;
			graphics.DrawPath(pen,path);

			//Render internal rectangle
			//Pen tempPen = new Pen(Color.Red,2);
			//graphics.DrawRectangle(tempPen,mInternalRectangle.X,mInternalRectangle.Y,mInternalRectangle.Width,mInternalRectangle.Height);
		}
Beispiel #32
0
        //Implement a base rendering of an element
        protected internal override void RenderShadow(Graphics graphics, IRender render)
        {
            if (mPoints == null)
            {
                return;
            }
            if (mPoints.Count < 2)
            {
                return;
            }

            PointF startLocation  = (PointF)mPoints[0];
            PointF startReference = (PointF)mPoints[1];
            PointF endLocation    = (PointF)mPoints[mPoints.Count - 1];
            PointF endReference   = (PointF)mPoints[mPoints.Count - 2];

            Layer        layer      = this.Layer;
            Pen          shadowPen  = new Pen(layer.ShadowColor);
            GraphicsPath shadowPath = GetPathInternal();

            shadowPen.Color = render.AdjustColor(layer.ShadowColor, 0, this.Opacity);

            //Save the current region
            Region current = graphics.Clip;

            //Mask out the start marker
            if (Start.Marker != null)
            {
                Region region = new Region(Start.Marker.GetPathInternal());
                region.Transform(GetMarkerTransform(Start.Marker, startLocation, startReference, new Matrix()));
                region.Translate(layer.ShadowOffset.X, layer.ShadowOffset.Y);
                graphics.SetClip(region, CombineMode.Exclude);
            }

            //Mask out the end marker
            if (End.Marker != null)
            {
                Region region = new Region(End.Marker.GetPathInternal());
                region.Transform(GetMarkerTransform(End.Marker, endLocation, endReference, new Matrix()));
                region.Translate(layer.ShadowOffset.X, layer.ShadowOffset.Y);
                graphics.SetClip(region, CombineMode.Exclude);
            }

            graphics.TranslateTransform(layer.ShadowOffset.X, layer.ShadowOffset.Y);

            //Draw line
            if (Layer.SoftShadows)
            {
                shadowPen.Color             = Color.FromArgb(20, shadowPen.Color);
                graphics.CompositingQuality = CompositingQuality.HighQuality;
                graphics.SmoothingMode      = SmoothingMode.HighQuality;
            }

            graphics.DrawPath(shadowPen, shadowPath);

            if (layer.SoftShadows)
            {
                graphics.CompositingQuality = render.CompositingQuality;
                graphics.SmoothingMode      = SmoothingMode;
            }

            //Restore graphics
            if (Start.Marker != null || End.Marker != null)
            {
                graphics.Clip = current;
                if (Start.Marker != null)
                {
                    RenderMarkerShadow(Start.Marker, startLocation, startReference, graphics, render);
                }
                if (End.Marker != null)
                {
                    RenderMarkerShadow(End.Marker, endLocation, endReference, graphics, render);
                }
            }

            graphics.TranslateTransform(-layer.ShadowOffset.X, -layer.ShadowOffset.Y);
        }