Esempio n. 1
0
        protected override void OnPaint(PaintEventArgs aPArgs)
        {
            Graphics lGraph = aPArgs.Graphics;

            lGraph.TextRenderingHint = TextRenderingHint.AntiAlias;
            Pen lPen = new Pen(Color.Black);

            lPen.Width = 2;
            Brush lbrHeader   = new LinearGradientBrush(new Point(0, 0), new Point(0, _HeaderSize), this.BackColor, _clHeader);
            Brush lbrText     = new SolidBrush(this.ForeColor);
            Font  lHeaderFont = new Font(this.Font.FontFamily, this.Font.Size, FontStyle.Bold, this.Font.Unit);
            SizeF lTextSize   = lGraph.MeasureString(_Title, lHeaderFont);

            lGraph.SmoothingMode = SmoothingMode.AntiAlias;

            Brush lBrush = new LinearGradientBrush(
                new Point(Margin.Left, 0),
                new Point(Margin.Left, _HeaderSize),
                ColorTools.Darken(50, _clHeader),
                _clHeader
                );

            ReportSmart.Graph.Drawing.Draw.RoundedRect(
                lGraph,
                new Rectangle(Margin.Left + 1, 1, this.Width - (Margin.Size.Width) - 1, _HeaderSize - 1),
                15,
                null,
                new SolidBrush(Color.FromArgb(0xa0, 0, 0, 0))
                );
            ReportSmart.Graph.Drawing.Draw.RoundedRect(
                lGraph,
                new Rectangle(Margin.Left, 0, this.Width - (Margin.Size.Width) - 1, _HeaderSize - 1),
                15,
                null,
                lBrush
                );

            Draw.DrawShadowedText(
                lGraph,
                new Point(
                    Margin.Left * 2 + (_OpenClose != null ? _OpenClose.Width : 0),
                    (int)(_HeaderSize - lTextSize.Height) / 2
                    ),
                _clHFont,
                Color.FromArgb(0xa0, 0, 0, 0),
                lHeaderFont,
                _Title
                );

            if (this.Parent != null)
            {
                lBrush = new SolidBrush(Parent.BackColor);
                lGraph.FillRectangle(lBrush, 0, 0, Margin.Left, this.ClientRectangle.Height);
                lGraph.FillRectangle(lBrush, this.ClientRectangle.Width - Margin.Right, 0, Margin.Right, this.ClientRectangle.Height);
            }
        }
Esempio n. 2
0
        protected override void OnPaint(PaintEventArgs aPArgs)
        {
            Graphics lGraph = aPArgs.Graphics;

            lGraph.SmoothingMode = SmoothingMode.AntiAlias;
            lGraph.FillRectangle(new SolidBrush(Color.White), this.ClientRectangle);

            Brush lBrush = new LinearGradientBrush(
                new Point(0, _vMargin),
                new Point(0, _vMargin + _vHeaderSize),
                ColorTools.Darken(50, _headerColor),
                _headerColor
                );

            ReportSmart.Graph.Drawing.Draw.RoundedRect(
                lGraph,
                new Rectangle(_hMargin + 1, _vMargin + 1, this.Width - _vMargin + 1, _vHeaderSize + 1),
                15,
                null,
                new SolidBrush(Color.FromArgb(0xa0, 0, 0, 0))
                );
            ReportSmart.Graph.Drawing.Draw.RoundedRect(
                lGraph,
                new Rectangle(_hMargin, _vMargin, this.Width - _vMargin, _vHeaderSize),
                15,
                null,
                lBrush
                );

            lBrush = new LinearGradientBrush(
                new Point(0, _waBottom),
                new Point(0, _waBottom + _vHeaderSize),
                ColorTools.Darken(50, _headerColor),
                _headerColor
                );
            ReportSmart.Graph.Drawing.Draw.RoundedRect(
                lGraph,
                new Rectangle(_hMargin + 1, _waBottom + 1, this.Width - _vMargin + 1, _vHeaderSize + 1),
                15,
                null,
                new SolidBrush(Color.FromArgb(0xa0, 0, 0, 0))
                );
            ReportSmart.Graph.Drawing.Draw.RoundedRect(
                lGraph,
                new Rectangle(_hMargin, _waBottom, this.Width - _vMargin, _vHeaderSize),
                15,
                null,
                lBrush
                );

            Font lFont       = new Font(RsViewEngine.DefaultFont.FontFamily, 14, FontStyle.Bold, GraphicsUnit.Point);
            int  lTextHeight = (int)(lGraph.MeasureString(_Title, lFont).Height);

            lGraph.DrawString(
                _Title,
                lFont,
                new SolidBrush(Color.White),
                new Point(_hMargin * 2, _hMargin * 2 + (_vHeaderSize - lTextHeight) / 2)
                );

            // Drawing columns:
            for (int i = 0; i < UsedColumnCount; i++)
            {
                ReportSmart.Graph.Drawing.Draw.RoundedRect(
                    lGraph,
                    new Rectangle(_hMargin + (columnWidth + _hMargin) * i, _waTop - (_vMargin / 2), columnWidth, _waHeight),
                    15,
                    null,
                    new SolidBrush(Color.FromArgb(0x80, _headerColor))
                    );
            }
        }
Esempio n. 3
0
        protected override void OnPaint(PaintEventArgs aPArgs)
        {
            if (_neverinitiated)
            {
                calculateFrame();
            }
            Graphics lGraph = aPArgs.Graphics;

            lGraph.SmoothingMode = SmoothingMode.HighQuality;
            int lMainTop   = (this.ClientRectangle.Height - _barHeight) / 2 - _barHeight * 2;
            int lSubTop    = (this.ClientRectangle.Height - _barHeight) / 2 - _barHeight;
            int lBarTop    = (this.ClientRectangle.Height - _barHeight) / 2;
            int lSubBarTop = (this.ClientRectangle.Height - _barHeight) / 2 + _barHeight + _barHeight / 2;
            int lBarWidth  = this.ClientRectangle.Width - (_leftMargin + _rightMargin);
            int lMainW     = (int)(lBarWidth * ((_cval - _cmin) / (double)(_cmax - _cmin)));
            int lSubW      = (int)(lBarWidth * ((_scval - _scmin) / (double)(_scmax - _scmin)));

            // The background:
            Pen   lPen                 = new Pen(Color.Black);
            Brush lTextBrush           = new SolidBrush(_textColor);
            LinearGradientBrush lBrush = new LinearGradientBrush(
                new Point(0, 0),
                new Point(0, this.ClientRectangle.Height),
                ColorTools.Darken(20, BackColor),
                ColorTools.Brighten(20, BackColor)
                );

            lGraph.FillRectangle(lBrush, ClientRectangle);

            // Main caption:
            lGraph.DrawString(
                "Itt vagyok!",
                new Font(Font, FontStyle.Bold),
                lTextBrush,
                _leftMargin * 2,
                lMainTop
                );

            // Sub caption:
            lGraph.DrawString(
                "Itt vagyok!",
                new Font(Font, FontStyle.Regular),
                lTextBrush,
                _leftMargin * 3,
                lSubTop
                );

            _cval  = 50;
            _scval = 25;
            // The main status bar
            lBrush = new LinearGradientBrush(
                new Point(_leftMargin, lBarTop - 2),
                new Point(_leftMargin, lBarTop + _barHeight + 2),
                ColorTools.Darken(50, BackColor),
                ColorTools.Darken(20, BackColor)
                );
            lGraph.FillRectangle(
                lBrush,
                new Rectangle(
                    _leftMargin, lBarTop,
                    lBarWidth, _barHeight
                    )
                );
            lBrush = new LinearGradientBrush(
                new Point(_leftMargin, lBarTop - 2),
                new Point(_leftMargin, lBarTop + _barHeight + 2),
                ColorTools.SetBrightness(80, _barColor),
                ColorTools.SetBrightness(20, _barColor)
                );
            lGraph.FillRectangle(
                lBrush,
                new Rectangle(
                    _leftMargin, lBarTop,
                    lMainW, _barHeight
                    )
                );

            // The sub status bar (if visible)
            if (_shSub)
            {
                lBrush = new LinearGradientBrush(
                    new Point(_leftMargin, lSubBarTop - 2),
                    new Point(_leftMargin, lSubBarTop + _barHeight + 2),
                    ColorTools.Darken(50, BackColor),
                    ColorTools.Darken(20, BackColor)
                    );
                lGraph.FillRectangle(
                    lBrush,
                    new Rectangle(
                        _leftMargin, lSubBarTop,
                        lBarWidth, _barHeight
                        )
                    );
                lBrush = new LinearGradientBrush(
                    new Point(_leftMargin, lSubBarTop - 2),
                    new Point(_leftMargin, lSubBarTop + _barHeight + 2),
                    ColorTools.SetBrightness(80, _barColor),
                    ColorTools.SetBrightness(20, _barColor)
                    );
                lGraph.FillRectangle(
                    lBrush,
                    new Rectangle(
                        _leftMargin, lSubBarTop,
                        lSubW, _barHeight
                        )
                    );
            }
        }
Esempio n. 4
0
        protected void DrawBar(
            Graphics aGraph,
            Rectangle aRect,
            bool aReflect
            )
        {
            aGraph.SmoothingMode = SmoothingMode.HighQuality;
            int       lHeight = aRect.Height, lWidth = aRect.Width;
            Rectangle lRect = new Rectangle(
                aRect.Left, aRect.Top,
                (int)((_val / (float)(_max - _min)) * (lWidth - 1)),
                lHeight - 1
                );

            ShadowDraw.RoundedRect(
                aGraph,
                new Rectangle(
                    aRect.Left + 0, aRect.Top + 0,
                    lWidth - 1, lHeight - 1
                    ),
                8,
                null,
                new SolidBrush(ColorTools.Darken(40, BackColor)),
                Color.FromArgb(0xa0, Color.Black),
                ShadowDraw.TShadowMode.smLower,
                2
                );
            if (lRect.Width != 0)
            {
                LinearGradientBrush lBrush = new LinearGradientBrush(
                    lRect,
                    Color.FromArgb(0xa0, Color.White),
                    Color.FromArgb(0xa0, Color.Black),
                    90
                    );

                Draw.RoundedRect(aGraph, lRect, 8, null, new SolidBrush(ForeColor));
                Draw.RoundedRect(aGraph, lRect, 8, null, lBrush);
            }

            if (_shText || _shPercent)
            {
                string lText = _shPercent ? Percent.ToString() + "%" : "";
                if (_shText)
                {
                    lText = _shPercent ? " (" + lText + ")" : "";
                    lText = Text + lText;
                }
                lText = "  " + lText + "  ";

                SizeF lTSize = aGraph.MeasureString(lText, Font);

                Draw.RoundedRect(
                    aGraph,
                    new Rectangle(
                        aRect.Left + (int)((lWidth - lTSize.Width) / 2),
                        aRect.Top + (int)((lHeight - (lTSize.Height + lTSize.Height / 2)) / 2),
                        (int)(lTSize.Width),
                        (int)(lTSize.Height + lTSize.Height / 2)
                        ),
                    8,
                    null,
                    new SolidBrush(Color.FromArgb(0xa0, _textBG))
                    );


                aGraph.DrawString(
                    lText,
                    Font,
                    new SolidBrush(TextColor),
                    new PointF(
                        aRect.Left + (lWidth - lTSize.Width) / 2,
                        aRect.Top + (lHeight - lTSize.Height) / 2
                        )
                    );
            }
        }