Exemple #1
0
        public override void Render(Graphics _g)
        {
            int _totalWidth = width * numbers + spacing * (numbers - 1);
            int _h          = height;

            int _x = x - _totalWidth / 2;
            int _y = y - height / 2;

            for (float i = 0; i < scales.Length; i++)
            {
                _g.FillRectangle(i == 0 || i == (scales.Length - 1) ? m_brush2 : m_brush, _x + width * i + spacing * i, _y - (_h * scales[(int)i]) / 2, width, _h * scales[(int)i]);
            }

            if (m_fondWide == 0)
            {
                m_fondWide = _g.MeasureString("Loading", NxFont.getFont(NxFonts.EuroCapital, 16)).Width;
            }
            //if()
            _g.DrawString("Loading", NxFont.getFont(NxFonts.EuroCapital, 16), m_brush, x - m_fondWide / 2, _y + height / 2);

            // _g.FillRectangle(m_brush, _x + _w + spacing,           _y - (_h * s2) / 2,   _w,   _h * s2);
            // _g.FillRectangle(m_brush, _x + _w * 2 + spacing * 2,   _y - (_h * s3) / 2,   _w,   _h * s3);
        }
Exemple #2
0
        public override void Render(Graphics _g)
        {
            if (m_showBounds)
            {
                _g.DrawRectangle(m_boundPen, x, y, width, height);
            }

            Font trFont = NxFont.getFont(font, size);

            string[] _lines = Regex.Split(text, "\r\n|\r|\n");

            if (reverseLineOrder)
            {
                Array.Reverse(_lines);
            }

            int _posY = 0;

            if (reverseDrawing)
            {
                _posY = height - trFont.Height;
            }
            foreach (string _line in _lines)
            {
                if (_g.MeasureString(_line, trFont).Width < width)
                {
                    _g.DrawString(_line, trFont, SolidBrush, x, y + _posY);
                    _posY += trFont.Height * (reverseDrawing ? -1 : 1);
                }
                else
                {
                    string[] _words = _line.Split(' ');

                    int _ii = 0;

                    while (_ii < _words.Length)
                    {
                        string _interline = "";
                        while (_ii < _words.Length)
                        {
                            string _newWord = (_interline.Length != 0 ? " " : "") + _words[_ii];
                            if (_g.MeasureString(_interline + _newWord, trFont).Width < width)
                            {
                                _interline += _newWord;
                                _ii++;
                            }
                            else
                            {
                                break;
                            }
                        }
                        _g.DrawString(_interline, trFont, SolidBrush, x, y + _posY);
                        _posY += trFont.Height * (reverseDrawing ? -1 : 1);
                        if (!autoWrap)
                        {
                            break;
                        }
                    }
                }

                if ((_posY > height && reverseDrawing) || (_posY < 0 && !reverseDrawing))
                {
                    break;
                }
            }
        }