Example #1
0
		private static void DrawCornerArc(Graphics g,ArcData arc,eStyleBorderType border,int lineWidth, Color color)
		{
			using(Pen pen=CreatePen(border,lineWidth,color))
			{
				g.DrawArc(pen,arc.X,arc.Y,arc.Width,arc.Height,arc.StartAngle,arc.SweepAngle);
			}
		}
Example #2
0
		private static DashStyle GetDashStyle(eStyleBorderType border)
		{
			DashStyle style=DashStyle.Solid;
			switch(border)
			{
				case eStyleBorderType.Dash:
                    style=DashStyle.Dash;
					break;
				case eStyleBorderType.DashDot:
					style=DashStyle.DashDot;
					break;
				case eStyleBorderType.DashDotDot:
					style=DashStyle.DashDotDot;
					break;
				case eStyleBorderType.Dot:
					style=DashStyle.Dot;
					break;
			}
			return style;
		}
Example #3
0
		private static void DrawBorderLine(Graphics g,Point[] p,eStyleBorderType border,int lineWidth, Color colorStart, Color colorEnd, Color colorLightStart, Color colorLightEnd, eBorderSide side)
		{
            if (border == eStyleBorderType.Etched || border == eStyleBorderType.Double)
            {
                if (colorLightStart.IsEmpty)
                {
                    colorLightStart = System.Windows.Forms.ControlPaint.Light(colorStart);
                    colorStart = System.Windows.Forms.ControlPaint.Dark(colorStart);
                }

                if (side == eBorderSide.Bottom || side == eBorderSide.Right)
                {
                    Color ct1 = colorStart;
                    Color ct2 = colorEnd;
                    colorStart = colorLightStart;
                    colorEnd = colorLightEnd;
                    colorLightStart = ct1;
                    colorLightEnd = ct2;
                }

                DisplayHelp.DrawGradientLine(g, p[0], p[1], colorStart, colorEnd, 90, lineWidth);
                
                if (side == eBorderSide.Top)
                {
                    p[0].Y+=lineWidth;
                    p[1].Y += lineWidth;
                }
                else if (side == eBorderSide.Bottom)
                {
                    p[0].Y -= lineWidth;
                    p[1].Y -= lineWidth;
                }
                else if (side == eBorderSide.Left || side == eBorderSide.BottomLeft || side == eBorderSide.TopLeft)
                {
                    p[0].X += lineWidth;
                    p[1].X += lineWidth;
                }
                else if (side == eBorderSide.Right || side == eBorderSide.BottomRight || side == eBorderSide.TopRight)
                {
                    p[0].X -= lineWidth;
                    p[1].X -= lineWidth;
                }

                DisplayHelp.DrawGradientLine(g, p[0], p[1], colorLightStart, colorLightEnd, 90, lineWidth);
            }
            else
            {
                DisplayHelp.DrawGradientLine(g, p[0], p[1], colorStart, colorEnd, 90, lineWidth);
            }
		}
Example #4
0
		private static Pen CreatePen(eStyleBorderType border,int lineWidth, Color color)
		{
			Pen pen=new Pen(color,lineWidth);
			pen.Alignment=PenAlignment.Inset;
			pen.DashStyle=ElementStyleDisplay.GetDashStyle(border);
			return pen;
		}
Example #5
0
 private static void DrawCornerArc(Graphics g, ArcData arc, eStyleBorderType border, int lineWidth, Color color)
 {
     SmoothingMode sm = g.SmoothingMode;
     if (sm == SmoothingMode.None) g.SmoothingMode = SmoothingMode.HighQuality;
     using (Pen pen = CreatePen(border, lineWidth, color))
     {
         g.DrawArc(pen, arc.X, arc.Y, arc.Width, arc.Height, arc.StartAngle, arc.SweepAngle);
     }
     if (sm == SmoothingMode.None) g.SmoothingMode = sm;
 }
Example #6
0
        private static void DrawBorderLine(Graphics g, Point[] p, eStyleBorderType border, int lineWidth, Color colorStart, Color colorEnd, Color colorLightStart, Color colorLightEnd, eBorderSide side, BorderDrawInfo drawInfo)
        {
            if (border == eStyleBorderType.Etched || border == eStyleBorderType.Double)
            {
                if (colorLightStart.IsEmpty)
                {
                    colorLightStart = System.Windows.Forms.ControlPaint.Light(colorStart);
                    colorStart = System.Windows.Forms.ControlPaint.Dark(colorStart);
                }

                if (drawInfo.IsTwistedDoubleBorder && (side == eBorderSide.Bottom || side == eBorderSide.Right))
                {
                    Color ct1 = colorStart;
                    Color ct2 = colorEnd;
                    colorStart = colorLightStart;
                    colorEnd = colorLightEnd;
                    colorLightStart = ct1;
                    colorLightEnd = ct2;
                }

                DisplayHelp.DrawGradientLine(g, p[0], p[1], colorStart, colorEnd, 90, lineWidth);

                if (side == eBorderSide.Top)
                {
                    p[0].Y += lineWidth;
                    p[1].Y += lineWidth;
                    if (drawInfo.HasLeftBorder)
                        p[0].X += 1;
                    if (drawInfo.HasRightBorder)
                        p[1].X -= 1;
                }
                else if (side == eBorderSide.Bottom)
                {
                    p[0].Y -= lineWidth;
                    p[1].Y -= lineWidth;
                    if (!drawInfo.IsTwistedDoubleBorder)
                    {
                        if (drawInfo.HasLeftBorder)
                            p[0].X += 1;
                        if (drawInfo.HasRightBorder)
                            p[1].X -= 1;
                    }
                }
                else if (side == eBorderSide.Left || side == eBorderSide.BottomLeft || side == eBorderSide.TopLeft)
                {
                    p[0].X += lineWidth;
                    p[1].X += lineWidth;
                    if (drawInfo.HasTopBorder)
                        p[0].Y += 1;
                    if (drawInfo.HasBottomBorder)
                        p[1].Y -= 1;
                }
                else if (side == eBorderSide.Right || side == eBorderSide.BottomRight || side == eBorderSide.TopRight)
                {
                    p[0].X -= lineWidth;
                    p[1].X -= lineWidth;
                    if (!drawInfo.IsTwistedDoubleBorder)
                    {
                        if (drawInfo.HasTopBorder)
                            p[0].Y += 1;
                        if (drawInfo.HasBottomBorder)
                            p[1].Y -= 1;
                    }
                }

                DisplayHelp.DrawGradientLine(g, p[0], p[1], colorLightStart, colorLightEnd, 90, lineWidth);
            }
            else
            {
                if (colorEnd.IsEmpty)
                {
                    SmoothingMode sm = g.SmoothingMode;
                    g.SmoothingMode = SmoothingMode.None;
                    using (Pen pen = CreatePen(border, lineWidth, colorStart))
                        g.DrawLine(pen, p[0], p[1]);
                    g.SmoothingMode = sm;
                }
                else
                    DisplayHelp.DrawGradientLine(g, p[0], p[1], colorStart, colorEnd, 90, lineWidth);
            }
        }
Example #7
0
        /// <summary>
        /// Reset all style properties to default values.
        /// </summary>
        public void Reset()
        {
            m_BackColor=Color.Empty;
		    m_BackColorSchemePart=eColorSchemePart.None;
		    m_BackColor2=Color.Empty;
		    m_BackColor2SchemePart=eColorSchemePart.None;
		    m_BackColorGradientAngle=0;
            m_BackColorGradientType = eGradientType.Linear;
		    m_BackgroundImage=null;
		    m_BackgroundImagePosition=eStyleBackgroundImage.Stretch;
		    m_BackgroundImageAlpha=255;
            m_BackColorBlend.Clear();

		    // Font
		    m_Font=null;

		    // Text Formating
		    m_WordWrap=false;
		    m_TextAlignment=eStyleTextAlignment.Near;
		    m_TextLineAlignment=eStyleTextAlignment.Center;
		    m_TextTrimming=eStyleTextTrimming.EllipsisCharacter;
		
            m_TextColor=Color.Empty;
		    m_TextColorSchemePart=eColorSchemePart.None;
            m_TextShadowColor = Color.Empty;
            m_TextShadowColorSchemePart = eColorSchemePart.None;
            m_TextShadowOffset = Point.Empty;

		    // Style margins
		    m_MarginLeft=0;
		    m_MarginRight=0;
		    m_MarginTop=0;
		    m_MarginBottom=0;

		    // Style inside padding
		    m_PaddingLeft=0;
		    m_PaddingRight=0;
		    m_PaddingTop=0;
		    m_PaddingBottom=0;

		    // Border
		    m_BorderLeft=eStyleBorderType.None;
		    m_BorderRight=eStyleBorderType.None;
		    m_BorderTop=eStyleBorderType.None;
		    m_BorderBottom=eStyleBorderType.None;

		    m_BorderColor=Color.Empty;
		    m_BorderColorSchemePart=eColorSchemePart.None;
            m_BorderColor2 = Color.Empty;
            m_BorderColor2SchemePart = eColorSchemePart.None;
            m_BorderGradientAngle = 90;
            m_BorderColorLight = Color.Empty;
            m_BorderColorLightSchemePart = eColorSchemePart.None;
            m_BorderColorLight2 = Color.Empty;
            m_BorderColorLight2SchemePart = eColorSchemePart.None;
            m_BorderLightGradientAngle = 90;

		    m_BorderLeftColor=Color.Empty;
		    m_BorderLeftColorSchemePart=eColorSchemePart.None;
		    m_BorderRightColor=Color.Empty;
		    m_BorderRightColorSchemePart=eColorSchemePart.None;
		    m_BorderTopColor=Color.Empty;
		    m_BorderTopColorSchemePart=eColorSchemePart.None;
		    m_BorderBottomColor=Color.Empty;
		    m_BorderBottomColorSchemePart=eColorSchemePart.None;

		    m_BorderLeftWidth=0;
		    m_BorderRightWidth=0;
		    m_BorderTopWidth=0;
		    m_BorderBottomWidth=0;

		    m_CornerType=eCornerType.Square;
		    m_CornerTypeTopLeft=eCornerType.Inherit;
		    m_CornerTypeTopRight=eCornerType.Inherit;
		    m_CornerTypeBottomLeft=eCornerType.Inherit;
		    m_CornerTypeBottomRight=eCornerType.Inherit;
		    m_CornerDiameter=DEFAULT_CORNER_DIAMETER;
            m_Class = "";
		    m_MaximumHeight=0;
        }