Ejemplo n.º 1
0
        /// <summary>
        /// Default public constructor.
        /// </summary>
        public Border3DAnnotation()
            : base()
        {
            this.isRectVisible         = false;
            this._borderSkin           = new BorderSkin(this);
            this._borderSkin.PageColor = Color.Transparent;
            this._borderSkin.SkinStyle = BorderSkinStyle.Raised;

            // Change default appearance styles
            this.lineColor = Color.Empty;
        }
Ejemplo n.º 2
0
        public static Chart GenerarGraficoSituacion()
        {
            Chart m_chart = new Chart();

            #region Chart setting
            m_chart.Palette                   = ChartColorPalette.None;
            m_chart.Width                     = Unit.Pixel(450);
            m_chart.Height                    = Unit.Pixel(400);
            m_chart.BorderlineDashStyle       = ChartDashStyle.Solid;
            m_chart.BackGradientStyle         = GradientStyle.TopBottom;
            m_chart.BorderlineColor           = ColorTranslator.FromHtml("#1A3B69");// Color.FromArgb(181, 64, 1);
            m_chart.BorderlineDashStyle       = ChartDashStyle.Solid;
            m_chart.BorderlineWidth           = 2;
            m_chart.BackColor                 = ColorTranslator.FromHtml("#D6D6D6");
            m_chart.SuppressExceptions        = true;
            m_chart.BackImageTransparentColor = ColorTranslator.FromHtml("#DDE6E9");
            m_chart.ImageType                 = ChartImageType.Png;
            m_chart.IsSoftShadows             = false;
            #endregion
            #region Título
            Title oTitulo = new Title();
            oTitulo.ShadowColor  = Color.FromArgb(32, 0, 0, 0);
            oTitulo.Font         = new Font("Arial", 14F, FontStyle.Bold);
            oTitulo.ShadowOffset = 3;
            oTitulo.Text         = "Situación del proyecto a mes de referencia";
            oTitulo.ForeColor    = Color.FromArgb(26, 59, 105);
            m_chart.Titles.Add(oTitulo);
            #endregion
            #region Legend
            Legend oLegend = new Legend("Default");
            oLegend.LegendStyle   = LegendStyle.Table;
            oLegend.IsTextAutoFit = false;
            oLegend.Docking       = Docking.Bottom;
            oLegend.BackColor     = Color.Transparent;
            oLegend.Font          = new Font("Arial", 8.25F, FontStyle.Bold);
            oLegend.Alignment     = StringAlignment.Center;
            m_chart.Legends.Add(oLegend);
            #endregion
            #region BorderSkin
            BorderSkin oBS = new BorderSkin();
            oBS.SkinStyle = BorderSkinStyle.Emboss;
            oBS.BackImageTransparentColor = ColorTranslator.FromHtml("#DDE6E9");
            oBS.BorderWidth    = 0;
            oBS.BorderColor    = ColorTranslator.FromHtml("#DDE6E9");
            oBS.PageColor      = ColorTranslator.FromHtml("#DDE6E9");
            m_chart.BorderSkin = oBS;
            #endregion
            #region ChartArea
            ChartArea oCA = new ChartArea();
            oCA.Name               = "ChartArea1";
            oCA.BorderColor        = Color.FromArgb(64, 64, 64, 64);
            oCA.BackSecondaryColor = Color.White;
            oCA.BackColor          = Color.OldLace;
            oCA.ShadowColor        = Color.Transparent;
            oCA.BackGradientStyle  = GradientStyle.TopBottom;
            oCA.BorderDashStyle    = ChartDashStyle.Solid;
            //area3dstyle
            oCA.Area3DStyle.Rotation         = 10;
            oCA.Area3DStyle.Perspective      = 10;
            oCA.Area3DStyle.Inclination      = 15;
            oCA.Area3DStyle.IsRightAngleAxes = false;
            oCA.Area3DStyle.WallWidth        = 0;
            oCA.Area3DStyle.IsClustered      = false;
            //axisy
            oCA.AxisY.LineColor = Color.FromArgb(64, 64, 64, 64);
            oCA.AxisY.LabelAutoFitMaxFontSize = 8;
            //oCA.AxisY.LabelStyle
            LabelStyle oLS = new LabelStyle();
            oLS.Font             = new Font("Arial", 8.25F, FontStyle.Bold);
            oLS.Format           = "N0";
            oLS.Interval         = 0.2;
            oCA.AxisY.LabelStyle = oLS;
            //MajorGrid
            oCA.AxisY.MajorGrid.LineColor = Color.FromArgb(64, 64, 64, 64);
            //axisx
            oCA.AxisX.LineColor = Color.FromArgb(64, 64, 64, 64);
            oCA.AxisX.LabelAutoFitMaxFontSize = 8;
            //oCA.AxisY.LabelStyle
            LabelStyle oLSX = new LabelStyle();
            oLSX.Font     = new Font("Arial", 8.25F, FontStyle.Bold);
            oLSX.Format   = "N0";
            oLSX.Interval = 0.2;
//            oLSX.IsEndLabelVisible = false;
//            oLSX.IntervalOffset = 0.0;
//            oLSX.IntervalOffsetType = DateTimeIntervalType.NotSet;
            //oLSX.IntervalOffset = 0;
//            oLSX.TruncatedLabels = true;
            oCA.AxisX.LabelStyle = oLSX;
            //MajorGrid
            oCA.AxisX.MajorGrid.LineColor = Color.FromArgb(64, 64, 64, 64);
            m_chart.ChartAreas.Add(oCA);
            //Serie
            Series oS = new Series("Proyecto");
            oS.YValuesPerPoint     = 1;
            oS.ChartType           = SeriesChartType.Bubble;
            oS.BorderColor         = Color.FromArgb(180, 26, 59, 105);
            oS.Color               = Color.FromArgb(220, 65, 140, 240);
            oS.Font                = new Font("Arial", 8.25F);
            oS.IsValueShownAsLabel = false;
            //IsValueShownAsLabel="True" YValuesPerPoint="2" Name="Proyecto" ChartType="Bubble"
            //BorderColor="180, 26, 59, 105" Color="220, 65, 140, 240" Font="Trebuchet MS, 9pt">
            m_chart.Series.Add(oS);
            #endregion

            //<asp:CHART id="ChartSPI2" runat="server" Palette="None" Width="450px" Height="400px" BorderDashStyle="Solid"
            //    BackGradientStyle="TopBottom" BorderWidth="2" BorderColor="181, 64, 1" BorderlineColor="#1A3B69" BorderlineDashStyle="Solid" BorderlineWidth="2" ImageLocation="~/TempImagesGraficos/ChartPic_#SEQ(300,3)" BackColor="#D6D6D6" SuppressExceptions="True" BorderSkin-BackColor="Gray" BorderSkin-PageColor="#DDE6E9" BorderSkin-SkinStyle="None" BackImageTransparentColor="#DDE6E9" ImageType="Png" IsSoftShadows="False" ImageStorageMode="UseImageLocation">
            //    <titles>
            //        <asp:Title ShadowColor="32, 0, 0, 0" Font="Arial, 14pt, style=Bold" ShadowOffset="3" Text="Situación del proyecto a mes de referencia" Name="Title1" ForeColor="26, 59, 105"></asp:Title>
            //    </titles>
            //    <legends>
            //        <asp:legend LegendStyle="Table" IsTextAutoFit="False" Docking="Bottom" Name="Default" BackColor="Transparent" Font="Arial, 8.25pt, style=Bold" Alignment="Center"></asp:legend>
            //    </legends>
            //    <BorderSkin SkinStyle="Emboss" BackImageTransparentColor="#DDE6E9" BorderWidth="0" BorderColor="#DDE6E9" PageColor="#DDE6E9" />
            //    <series>
            //        <asp:Series IsValueShownAsLabel="True" YValuesPerPoint="2" Name="Proyecto" ChartType="Bubble" BorderColor="180, 26, 59, 105" Color="220, 65, 140, 240" Font="Trebuchet MS, 9pt">
            //            <points>
            //                <asp:DataPoint YValues="15,8" />
            //            </points>
            //        </asp:Series>
            //    </series>
            //    <chartareas>
            //        <asp:ChartArea Name="ChartArea1" BorderColor="Black" BackSecondaryColor="White" BackColor="OldLace" ShadowColor="Transparent" BackGradientStyle="TopBottom" BorderDashStyle="Solid">
            //            <area3dstyle Rotation="10" Perspective="10" Inclination="15" IsRightAngleAxes="False" WallWidth="0" IsClustered="False" />
            //            <axisy LineColor="64, 64, 64, 64"  LabelAutoFitMaxFontSize="8">
            //                <LabelStyle Font="Arial, 8.25pt, style=Bold" Format="N0" Interval="0.2" />
            //                <MajorGrid LineColor="64, 64, 64, 64" />
            //            </axisy>
            //            <axisx LineColor="64, 64, 64, 64" LabelAutoFitMaxFontSize="8">
            //                <LabelStyle Font="Arial, 8.25pt, style=Bold"  Format="N0" Interval="0.2" />
            //                <MajorGrid LineColor="64, 64, 64, 64" />
            //            </axisx>
            //        </asp:ChartArea>
            //    </chartareas>
            //</asp:CHART>


            return(m_chart);
        }
Ejemplo n.º 3
0
        public static Chart GenerarGraficoAnalisis()
        {
            Chart m_chart = new Chart();

            #region Chart setting
            m_chart.Palette                   = ChartColorPalette.None;
            m_chart.Width                     = Unit.Pixel(500);
            m_chart.Height                    = Unit.Pixel(360);
            m_chart.BorderlineDashStyle       = ChartDashStyle.Solid;
            m_chart.BackGradientStyle         = GradientStyle.TopBottom;
            m_chart.BorderlineColor           = ColorTranslator.FromHtml("#1A3B69");// Color.FromArgb(181, 64, 1);
            m_chart.BorderlineDashStyle       = ChartDashStyle.Solid;
            m_chart.BorderlineWidth           = 2;
            m_chart.BackColor                 = ColorTranslator.FromHtml("#D6D6D6");
            m_chart.SuppressExceptions        = true;
            m_chart.BackImageTransparentColor = ColorTranslator.FromHtml("#DDE6E9");
            m_chart.ImageType                 = ChartImageType.Png;
            m_chart.IsSoftShadows             = false;
            #endregion
            #region Título
            Title oTitulo = new Title();
            oTitulo.ShadowColor  = Color.FromArgb(32, 0, 0, 0);
            oTitulo.Font         = new Font("Arial", 14.25F, FontStyle.Bold);
            oTitulo.ShadowOffset = 3;
            oTitulo.Text         = "Gráfico de análisis del Valor Ganado";
            oTitulo.ForeColor    = Color.FromArgb(26, 59, 105);
            m_chart.Titles.Add(oTitulo);
            #endregion
            #region Legend
            Legend oLegend = new Legend("Default");
            oLegend.LegendStyle   = LegendStyle.Table;
            oLegend.IsTextAutoFit = false;
            oLegend.Docking       = Docking.Bottom;
            oLegend.BackColor     = Color.Transparent;
            oLegend.Font          = new Font("Arial", 8.25F, FontStyle.Bold);
            oLegend.Alignment     = StringAlignment.Center;
            m_chart.Legends.Add(oLegend);
            #endregion
            #region BorderSkin
            BorderSkin oBS = new BorderSkin();
            oBS.SkinStyle = BorderSkinStyle.Emboss;
            oBS.BackImageTransparentColor = ColorTranslator.FromHtml("#DDE6E9");
            oBS.BorderWidth    = 0;
            oBS.BorderColor    = ColorTranslator.FromHtml("#DDE6E9");
            oBS.PageColor      = ColorTranslator.FromHtml("#DDE6E9");
            m_chart.BorderSkin = oBS;
            #endregion
            #region ChartArea
            ChartArea oCA = new ChartArea();
            oCA.Name               = "ChartArea1";
            oCA.BorderColor        = Color.FromArgb(64, 64, 64, 64);
            oCA.BackSecondaryColor = Color.White;
            oCA.BackColor          = Color.OldLace;
            oCA.ShadowColor        = Color.Transparent;
            oCA.BackGradientStyle  = GradientStyle.TopBottom;
            //area3dstyle
            oCA.Area3DStyle.Rotation         = 10;
            oCA.Area3DStyle.Perspective      = 10;
            oCA.Area3DStyle.Inclination      = 15;
            oCA.Area3DStyle.IsRightAngleAxes = false;
            oCA.Area3DStyle.WallWidth        = 0;
            oCA.Area3DStyle.IsClustered      = false;
            //axisy
            oCA.AxisY.LineColor = Color.FromArgb(64, 64, 64, 64);
            oCA.AxisY.LabelAutoFitMaxFontSize = 8;
            //oCA.AxisY.LabelStyle
            LabelStyle oLS = new LabelStyle();
            oLS.Font             = new Font("Arial", 8.25F, FontStyle.Bold);
            oLS.Format           = "N0";
            oCA.AxisY.LabelStyle = oLS;
            //MajorGrid
            oCA.AxisY.MajorGrid.LineColor = Color.FromArgb(64, 64, 64, 64);
            //axisx
            oCA.AxisX.LineColor = Color.FromArgb(64, 64, 64, 64);
            oCA.AxisX.LabelAutoFitMaxFontSize = 8;
            //oCA.AxisY.LabelStyle
            LabelStyle oLSX = new LabelStyle();
            oLSX.Font = new Font("Arial", 8.25F, FontStyle.Bold);
            oLSX.IsEndLabelVisible = false;
            oLSX.Interval          = 1.0;
            //oLSX.IntervalType =
            //oLSX.IntervalType = DateTimeIntervalType.Auto;
            oLSX.IntervalOffset     = 0.0;
            oLSX.IntervalOffsetType = DateTimeIntervalType.NotSet;
            //oLSX.IntervalOffset = 0;
            oLSX.TruncatedLabels = true;
            oCA.AxisX.LabelStyle = oLSX;
            //MajorGrid
            oCA.AxisX.MajorGrid.LineColor = Color.FromArgb(64, 64, 64, 64);

            m_chart.ChartAreas.Add(oCA);
            #endregion

            //<asp:CHART id="Chart1" oncustomizelegend="Chart1_CustomizeLegend" runat="server" Palette="None" Width="500px" Height="380px" BorderDashStyle="Solid"
            //    BackGradientStyle="TopBottom" BorderWidth="2" BorderColor="181, 64, 1" BorderlineColor="#1A3B69" BorderlineDashStyle="Solid" BorderlineWidth="2" ImageLocation="~/TempImagesGraficos/ChartPic_#SEQ(300,3)" BackColor="#D6D6D6"
            //    SuppressExceptions="True" BorderSkin-BackColor="Gray" BorderSkin-PageColor="#DDE6E9" BorderSkin-SkinStyle="None" BackImageTransparentColor="#DDE6E9"
            //    ImageType="Png" IsSoftShadows="False" ImageStorageMode="UseImageLocation">
            //    <titles>
            //        <asp:Title ShadowColor="32, 0, 0, 0" Font="Arial, 14.25pt, style=Bold" ShadowOffset="3" Text="Gráfico de análisis del Valor Ganado" Name="Title1" ForeColor="26, 59, 105"></asp:Title>
            //    </titles>
            //    <legends>
            //        <asp:legend LegendStyle="Table" IsTextAutoFit="False" Docking="Bottom" Name="Default" BackColor="Transparent" Font="Arial, 8.25pt, style=Bold" Alignment="Center"></asp:legend>
            //    </legends>
            //    <BorderSkin SkinStyle="Emboss" BackImageTransparentColor="#DDE6E9" BorderWidth="0" BorderColor="#DDE6E9" PageColor="#DDE6E9" />
            //    <chartareas>
            //        <asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BackSecondaryColor="White" BackColor="OldLace" ShadowColor="Transparent" BackGradientStyle="TopBottom">
            //            <area3dstyle Rotation="10" Perspective="10" Inclination="15" IsRightAngleAxes="False" WallWidth="0" IsClustered="False" />
            //            <axisy LineColor="64, 64, 64, 64"  LabelAutoFitMaxFontSize="8">
            //                <LabelStyle Font="Arial, 8.25pt, style=Bold" Format="N0" />
            //                <MajorGrid LineColor="64, 64, 64, 64" />
            //            </axisy>
            //            <axisx LineColor="64, 64, 64, 64" LabelAutoFitMaxFontSize="8">
            //                <LabelStyle Font="Arial, 8.25pt, style=Bold" IsEndLabelVisible="False" Interval="1" IntervalOffset="NotSet" TruncatedLabels="True" />
            //                <MajorGrid LineColor="64, 64, 64, 64" />
            //            </axisx>
            //        </asp:ChartArea>
            //    </chartareas>
            //</asp:CHART>

            return(m_chart);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Draws 3D border
        /// </summary>
        /// <param name="graph">Graphics to draw the border on.</param>
        /// <param name="borderSkin">Border skin object.</param>
        /// <param name="rect">Rectangle of the border.</param>
        /// <param name="backColor">Color of rectangle</param>
        /// <param name="backHatchStyle">Hatch style</param>
        /// <param name="backImage">Back Image</param>
        /// <param name="backImageWrapMode">Image mode</param>
        /// <param name="backImageTransparentColor">Image transparent color.</param>
        /// <param name="backImageAlign">Image alignment</param>
        /// <param name="backGradientStyle">Gradient type</param>
        /// <param name="backSecondaryColor">Gradient End Color</param>
        /// <param name="borderColor">Border Color</param>
        /// <param name="borderWidth">Border Width</param>
        /// <param name="borderDashStyle">Border Style</param>
        public virtual void DrawBorder(
            ChartGraphics graph,
            BorderSkin borderSkin,
            RectangleF rect,
            Color backColor,
            ChartHatchStyle backHatchStyle,
            string backImage,
            ChartImageWrapMode backImageWrapMode,
            Color backImageTransparentColor,
            ChartImageAlignmentStyle backImageAlign,
            GradientStyle backGradientStyle,
            Color backSecondaryColor,
            Color borderColor,
            int borderWidth,
            ChartDashStyle borderDashStyle)
        {
            RectangleF absolute   = graph.Round(rect);
            RectangleF shadowRect = absolute;

            // Calculate shadow colors (0.2 - 0.6)
            float colorDarkeningIndex = 0.3f + (0.4f * (borderSkin.PageColor.R + borderSkin.PageColor.G + borderSkin.PageColor.B) / 765f);
            Color shadowColor         = Color.FromArgb(
                (int)(backColor.R * colorDarkeningIndex),
                (int)(backColor.G * colorDarkeningIndex),
                (int)(backColor.B * colorDarkeningIndex));

            colorDarkeningIndex += 0.2f;
            Color shadowLightColor = Color.FromArgb(
                (int)(borderSkin.PageColor.R * colorDarkeningIndex),
                (int)(borderSkin.PageColor.G * colorDarkeningIndex),
                (int)(borderSkin.PageColor.B * colorDarkeningIndex));

            if (borderSkin.PageColor == Color.Transparent)
            {
                shadowLightColor = Color.FromArgb(60, 0, 0, 0);
            }

            // Calculate rounded rect radius
            float radius = defaultRadiusSize;

            radius = (float)Math.Max(radius, 2f * resolution / 96.0f);
            radius = (float)Math.Min(radius, rect.Width / 2f);
            radius = (float)Math.Min(radius, rect.Height / 2f);
            radius = (float)Math.Ceiling(radius);

            // Fill page background color
            using (Brush brush = new SolidBrush(borderSkin.PageColor))
            {
                graph.FillRectangle(brush, rect);
            }

            if (drawOutsideTopLeftShadow)
            {
                // Top/Left outside shadow
                shadowRect         = absolute;
                shadowRect.X      -= radius * 0.3f;
                shadowRect.Y      -= radius * 0.3f;
                shadowRect.Width  -= radius * .3f;
                shadowRect.Height -= radius * .3f;
                graph.DrawRoundedRectShadowAbs(shadowRect, cornerRadius, radius, Color.FromArgb(128, Color.Black), borderSkin.PageColor, outsideShadowRate);
            }

            // Bottom/Right outside shadow
            shadowRect         = absolute;
            shadowRect.X      += radius * 0.3f;
            shadowRect.Y      += radius * 0.3f;
            shadowRect.Width  -= radius * .3f;
            shadowRect.Height -= radius * .3f;
            graph.DrawRoundedRectShadowAbs(shadowRect, cornerRadius, radius, shadowLightColor, borderSkin.PageColor, outsideShadowRate);

            // Background
            shadowRect         = absolute;
            shadowRect.Width  -= radius * .3f;
            shadowRect.Height -= radius * .3f;
            GraphicsPath path = graph.CreateRoundedRectPath(shadowRect, cornerRadius);

            graph.DrawPathAbs(
                path,
                backColor,
                backHatchStyle,
                backImage,
                backImageWrapMode,
                backImageTransparentColor,
                backImageAlign,
                backGradientStyle,
                backSecondaryColor,
                borderColor,
                borderWidth,
                borderDashStyle,
                PenAlignment.Inset);

            // Dispose Graphic path
            if (path != null)
            {
                path.Dispose();
            }

            // Draw ----s imitation in the corners of the farame
            if (drawScrews)
            {
                // Left/Top ----
                RectangleF screwRect = RectangleF.Empty;
                float      offset    = radius * 0.4f;
                screwRect.X      = shadowRect.X + offset;
                screwRect.Y      = shadowRect.Y + offset;
                screwRect.Width  = radius * 0.55f;
                screwRect.Height = screwRect.Width;
                DrawScrew(graph, screwRect);

                // Right/Top ----
                screwRect.X = shadowRect.Right - offset - screwRect.Width;
                DrawScrew(graph, screwRect);

                // Right/Bottom ----
                screwRect.X = shadowRect.Right - offset - screwRect.Width;
                screwRect.Y = shadowRect.Bottom - offset - screwRect.Height;
                DrawScrew(graph, screwRect);

                // Left/Bottom ----
                screwRect.X = shadowRect.X + offset;
                screwRect.Y = shadowRect.Bottom - offset - screwRect.Height;
                DrawScrew(graph, screwRect);
            }

            // Bottom/Right inner shadow
            Region innerShadowRegion = null;

            if (drawBottomShadow)
            {
                shadowRect         = absolute;
                shadowRect.Width  -= radius * .3f;
                shadowRect.Height -= radius * .3f;
                innerShadowRegion  = new Region(
                    graph.CreateRoundedRectPath(
                        new RectangleF(
                            shadowRect.X - radius,
                            shadowRect.Y - radius,
                            shadowRect.Width + 0.5f * radius,
                            shadowRect.Height + 0.5f * radius),
                        cornerRadius));
                innerShadowRegion.Complement(graph.CreateRoundedRectPath(shadowRect, cornerRadius));
                graph.Clip = innerShadowRegion;

                shadowRect.X      -= 0.5f * radius;
                shadowRect.Width  += 0.5f * radius;
                shadowRect.Y      -= 0.5f * radius;
                shadowRect.Height += 0.5f * radius;

                graph.DrawRoundedRectShadowAbs(
                    shadowRect,
                    cornerRadius,
                    radius,
                    Color.Transparent,
                    Color.FromArgb(175, (sunken) ? Color.White : shadowColor),
                    1.0f);
                graph.Clip = new Region();
            }

            // Top/Left inner shadow
            shadowRect         = absolute;
            shadowRect.Width  -= radius * .3f;
            shadowRect.Height -= radius * .3f;
            innerShadowRegion  = new Region(
                graph.CreateRoundedRectPath(
                    new RectangleF(
                        shadowRect.X + radius * .5f,
                        shadowRect.Y + radius * .5f,
                        shadowRect.Width - .2f * radius,
                        shadowRect.Height - .2f * radius),
                    cornerRadius));

            RectangleF shadowWithOffset = shadowRect;

            shadowWithOffset.Width  += radius;
            shadowWithOffset.Height += radius;
            innerShadowRegion.Complement(graph.CreateRoundedRectPath(shadowWithOffset, cornerRadius));

            innerShadowRegion.Intersect(graph.CreateRoundedRectPath(shadowRect, cornerRadius));
            graph.Clip = innerShadowRegion;
            graph.DrawRoundedRectShadowAbs(
                shadowWithOffset,
                cornerRadius,
                radius,
                Color.Transparent,
                Color.FromArgb(175, (sunken) ? shadowColor : Color.White),
                1.0f);
            graph.Clip = new Region();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Draws 3D border.
        /// </summary>
        /// <param name="graph">Graphics to draw the border on.</param>
        /// <param name="borderSkin">Border skin object.</param>
        /// <param name="rect">Rectangle of the border.</param>
        /// <param name="backColor">Color of rectangle</param>
        /// <param name="backHatchStyle">Hatch style</param>
        /// <param name="backImage">Back Image</param>
        /// <param name="backImageWrapMode">Image mode</param>
        /// <param name="backImageTransparentColor">Image transparent color.</param>
        /// <param name="backImageAlign">Image alignment</param>
        /// <param name="backGradientStyle">Gradient type</param>
        /// <param name="backSecondaryColor">Gradient End Color</param>
        /// <param name="borderColor">Border Color</param>
        /// <param name="borderWidth">Border Width</param>
        /// <param name="borderDashStyle">Border Style</param>
        public override void DrawBorder(
            ChartGraphics graph,
            BorderSkin borderSkin,
            RectangleF rect,
            Color backColor,
            ChartHatchStyle backHatchStyle,
            string backImage,
            ChartImageWrapMode backImageWrapMode,
            Color backImageTransparentColor,
            ChartImageAlignmentStyle backImageAlign,
            GradientStyle backGradientStyle,
            Color backSecondaryColor,
            Color borderColor,
            int borderWidth,
            ChartDashStyle borderDashStyle)
        {
            drawBottomShadow         = true;
            sunken                   = false;
            outsideShadowRate        = .9f;
            drawOutsideTopLeftShadow = false;
            bool oldScrewsFlag = this.drawScrews;

            this.drawScrews = false;
            base.DrawBorder(
                graph,
                borderSkin,
                rect,
                borderSkin.BackColor,
                borderSkin.BackHatchStyle,
                borderSkin.BackImage,
                borderSkin.BackImageWrapMode,
                borderSkin.BackImageTransparentColor,
                borderSkin.BackImageAlignment,
                borderSkin.BackGradientStyle,
                borderSkin.BackSecondaryColor,
                borderSkin.BorderColor,
                borderSkin.BorderWidth,
                borderSkin.BorderDashStyle);

            this.drawScrews = oldScrewsFlag;
            rect.X         += sizeLeftTop.Width;
            rect.Y         += sizeLeftTop.Height;
            rect.Width     -= sizeRightBottom.Width + sizeLeftTop.Width;
            rect.Height    -= sizeRightBottom.Height + sizeLeftTop.Height;
            if (rect.Width > 0 && rect.Height > 0)
            {
                float[] oldCorners = new float[8];
                oldCorners               = (float[])cornerRadius.Clone();
                cornerRadius             = innerCorners;
                drawBottomShadow         = false;
                sunken                   = true;
                drawOutsideTopLeftShadow = true;
                outsideShadowRate        = 1.4f;
                Color oldPageColor = borderSkin.PageColor;
                borderSkin.PageColor = Color.Transparent;
                base.DrawBorder(
                    graph,
                    borderSkin,
                    rect,
                    backColor,
                    backHatchStyle,
                    backImage,
                    backImageWrapMode,
                    backImageTransparentColor,
                    backImageAlign,
                    backGradientStyle,
                    backSecondaryColor,
                    borderColor,
                    borderWidth,
                    borderDashStyle);
                borderSkin.PageColor = oldPageColor;
                cornerRadius         = oldCorners;
            }
        }
Ejemplo n.º 6
0
        public Chart GenChart(string modulecode)
        {
            var list = instance.GetListByWhere(string.Format(" AND CM_Module='{0}'", modulecode));

            if (list.Count == 0)
            {
                return(null);
            }
            var   charModel = list[0];
            Chart Chart1    = new Chart();

            try
            {
                #region Step1. 設定 Chart Title
                //Title ChartTitle = new Title();
                //System.Drawing.Font font = new System.Drawing.Font("黑体", 20, FontStyle.Bold);


                ////字体设置
                //ChartTitle.Font = font;
                //ChartTitle.ForeColor = System.Drawing.ColorTranslator.FromHtml("#6B8E23");
                ////图表名称
                //ChartTitle.Text = charModel.CM_Title;
                ////新增至Chart Control
                //Chart1.Titles.Add(ChartTitle);
                #endregion


                #region Step2. 產生工作區塊(Area1)
                ChartArea cArea1 = new ChartArea(charModel.CM_ChartAreas);

                Chart1.Width  = charModel.CM_Width;
                Chart1.Height = charModel.CM_Height;

                //設定Area1的X,Y軸標題
                // cArea1.AxisX.Title = charModel.CM_XTitle;
                // cArea1.AxisY.Title = charModel.CM_YTitle;
                //X,Y軸刻度區間
                if (!string.IsNullOrEmpty(charModel.CM_XInterval))
                {
                    cArea1.AxisX.Interval = double.Parse(charModel.CM_XInterval);
                }
                if (!string.IsNullOrEmpty(charModel.CM_YInterval))
                {
                    cArea1.AxisY.Interval = double.Parse(charModel.CM_YInterval);
                }


                // Chart1.BackColor = System.Drawing.Color.AliceBlue;
                // Chart1.BackGradientStyle = GradientStyle.TopBottom;
                // Set Border Width
                // Chart1.BorderWidth = 2;

                // Chart Image Mode
                // Chart1.BackImageWrapMode = ChartImageWrapMode.TileFlipX;

                Chart1.ChartAreas.Add(cArea1);
                #endregion

                #region 样式设置

                var c = new BorderSkin();
                c.SkinStyle       = BorderSkinStyle.Emboss;
                Chart1.BorderSkin = c;

                cArea1.BorderDashStyle = ChartDashStyle.Solid;

                cArea1.BorderWidth = 1;

                cArea1.BorderColor = colorHx16toRGB("#AAB6C5");

                cArea1.BackColor          = colorHx16toRGB("#e3e3e3");
                cArea1.BackSecondaryColor = Color.White;
                cArea1.BackGradientStyle  = GradientStyle.TopBottom;

                cArea1.AxisX.TitleFont = new Font("微软雅黑", 12);
                cArea1.AxisY.TitleFont = new Font("微软雅黑", 12);

                cArea1.AxisX.LineColor = colorHx16toRGB("#AAB6C5");
                cArea1.AxisX.LineWidth = 1;

                cArea1.AxisY.LineColor = colorHx16toRGB("#AAB6C5");
                cArea1.AxisY.LineWidth = 1;
                //----

                var l = new LabelStyle();
                l.Font                  = new Font("微软雅黑", 20, FontStyle.Bold);
                l.ForeColor             = colorHx16toRGB("#404040");
                cArea1.AxisX.LabelStyle = l;


                var ly = new LabelStyle();
                ly.Font                 = new Font("微软雅黑", 20, FontStyle.Bold);
                ly.ForeColor            = colorHx16toRGB("#404040");
                cArea1.AxisY.LabelStyle = ly;



                cArea1.AxisX.MajorGrid.LineColor = colorHx16toRGB("#AAB6C5");
                cArea1.AxisY.MajorGrid.LineColor = colorHx16toRGB("#AAB6C5");

                Chart1.BackColor          = colorHx16toRGB("#e3e3e3");
                Chart1.BackSecondaryColor = Color.White;
                Chart1.BackGradientStyle  = GradientStyle.TopBottom;



                var d = new ChartArea3DStyle();

                d.Rotation         = 10;
                d.Perspective      = 10;
                d.IsRightAngleAxes = false;
                d.WallWidth        = 0;
                d.IsClustered      = false;
                d.LightStyle       = LightStyle.Realistic;
                cArea1.Area3DStyle = d;
                #endregion
            }
            catch (Exception ex)
            {
                return(null);
            }

            return(Chart1);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Draws 3D border.
        /// </summary>
        /// <param name="graph">Graphics to draw the border on.</param>
        /// <param name="borderSkin">Border skin object.</param>
        /// <param name="rect">Rectangle of the border.</param>
        /// <param name="backColor">Color of rectangle</param>
        /// <param name="backHatchStyle">Hatch style</param>
        /// <param name="backImage">Back Image</param>
        /// <param name="backImageWrapMode">Image mode</param>
        /// <param name="backImageTransparentColor">Image transparent color.</param>
        /// <param name="backImageAlign">Image alignment</param>
        /// <param name="backGradientStyle">Gradient type</param>
        /// <param name="backSecondaryColor">Gradient End Color</param>
        /// <param name="borderColor">Border Color</param>
        /// <param name="borderWidth">Border Width</param>
        /// <param name="borderDashStyle">Border Style</param>
        public virtual void DrawBorder(
            ChartGraphics graph,
            BorderSkin borderSkin,
            RectangleF rect,
            Color backColor,
            ChartHatchStyle backHatchStyle,
            string backImage,
            ChartImageWrapMode backImageWrapMode,
            Color backImageTransparentColor,
            ChartImageAlignmentStyle backImageAlign,
            GradientStyle backGradientStyle,
            Color backSecondaryColor,
            Color borderColor,
            int borderWidth,
            ChartDashStyle borderDashStyle)
        {
            RectangleF absolute   = graph.Round(rect);
            RectangleF shadowRect = absolute;

            // Calculate shadow colors (0.2 - 0.6)
            float colorDarkeningIndex = 0.2f + (0.4f * (borderSkin.PageColor.R + borderSkin.PageColor.G + borderSkin.PageColor.B) / 765f);
            Color shadowColor         = Color.FromArgb(
                (int)(borderSkin.PageColor.R * colorDarkeningIndex),
                (int)(borderSkin.PageColor.G * colorDarkeningIndex),
                (int)(borderSkin.PageColor.B * colorDarkeningIndex));

            if (borderSkin.PageColor == Color.Transparent)
            {
                shadowColor = Color.FromArgb(60, 0, 0, 0);
            }

            colorDarkeningIndex += 0.2f;
            Color shadowLightColor = Color.FromArgb(
                (int)(borderSkin.PageColor.R * colorDarkeningIndex),
                (int)(borderSkin.PageColor.G * colorDarkeningIndex),
                (int)(borderSkin.PageColor.B * colorDarkeningIndex));

            // Calculate rounded rect radius
            float radius = defaultRadiusSize;

            radius = (float)Math.Max(radius, 2f * resolution / 96.0f);
            radius = (float)Math.Min(radius, rect.Width / 2f);
            radius = (float)Math.Min(radius, rect.Height / 2f);
            radius = (float)Math.Ceiling(radius);

            // Fill page background color
            using (Brush brush = new SolidBrush(borderSkin.PageColor))
            {
                graph.FillRectangle(brush, rect);
            }

            // Top/Left shadow
            shadowRect         = absolute;
            shadowRect.Width  -= radius * .3f;
            shadowRect.Height -= radius * .3f;
            graph.DrawRoundedRectShadowAbs(shadowRect, cornerRadius, radius + 1 * resolution / 96.0f, shadowLightColor, borderSkin.PageColor, 1.4f);

            // Bottom/Right shadow
            shadowRect         = absolute;
            shadowRect.X       = absolute.X + radius / 3f;
            shadowRect.Y       = absolute.Y + radius / 3f;
            shadowRect.Width  -= radius / 3.5f;
            shadowRect.Height -= radius / 3.5f;
            graph.DrawRoundedRectShadowAbs(shadowRect, cornerRadius, radius, shadowColor, borderSkin.PageColor, 1.3f);

            // Draw Background
            shadowRect         = absolute;
            shadowRect.X       = absolute.X + 3f * resolution / 96.0f;
            shadowRect.Y       = absolute.Y + 3f * resolution / 96.0f;
            shadowRect.Width  -= radius * .75f;
            shadowRect.Height -= radius * .75f;
            GraphicsPath path = graph.CreateRoundedRectPath(shadowRect, cornerRadius);

            graph.DrawPathAbs(
                path,
                backColor,
                backHatchStyle,
                backImage,
                backImageWrapMode,
                backImageTransparentColor,
                backImageAlign,
                backGradientStyle,
                backSecondaryColor,
                borderColor,
                borderWidth,
                borderDashStyle,
                PenAlignment.Inset);

            // Dispose Graphic path
            if (path != null)
            {
                path.Dispose();
            }

            // Bottom/Right inner shadow
            Region innerShadowRegion = new Region(
                graph.CreateRoundedRectPath(
                    new RectangleF(
                        shadowRect.X - radius,
                        shadowRect.Y - radius,
                        shadowRect.Width + radius - radius * 0.25f,
                        shadowRect.Height + radius - radius * 0.25f),
                    cornerRadius));

            innerShadowRegion.Complement(graph.CreateRoundedRectPath(shadowRect, cornerRadius));
            graph.Clip = innerShadowRegion;
            graph.DrawRoundedRectShadowAbs(
                shadowRect,
                cornerRadius,
                radius,
                Color.Transparent,
                Color.FromArgb(128, Color.Gray),
                .5f);
            graph.Clip = new Region();
        }