Beispiel #1
0
        public void SetText(String text)
        {
            this.Clear();
            int y = 0;

            foreach (String line in Wrap(text))
            {
                if (y > this.Size.Height - 1)
                {
                    break;
                }

                int x = 0;
                foreach (char c in line)
                {
                    if (x > this.Size.Width - 1)
                    {
                        break;
                    }
                    RegionTile tile = this.RegionTiles[x, y];
                    tile.ClearGlyphs();
                    tile.AddGlyph((int)c, Color, Background);
                    ++x;
                }
                ++y;
            }
        }
Beispiel #2
0
        protected override void Render()
        {
            this.Clear();
            int y = 0;

            if (this.AutoSizeToContents)
            {
                this.Size = new Size(0, 0);
                this.AutoSizeToContents = true;
            }
            foreach (String line in Wrap(text))
            {
                if (y > this.Size.Height - 1)
                {
                    if (this.AutoSizeToContents == false)
                    {
                        break;
                    }
                    else
                    {
                        this.Size = new Size(this.Size.Width, this.Size.Height + 1);
                        this.AutoSizeToContents = true;
                    }
                }

                int x = 0;
                foreach (char c in line)
                {
                    if (x > this.Size.Width - 1)
                    {
                        if (this.AutoSizeToContents == false)
                        {
                            break;
                        }
                        else
                        {
                            this.Size = new Size(this.Size.Width + 1, this.Size.Height);
                            this.AutoSizeToContents = true;
                        }
                    }
                    RegionTile tile = this.RegionTiles[x, y];
                    tile.ClearGlyphs();
                    tile.AddGlyph((int)c, Color, Background);
                    ++x;
                }
                ++y;
            }
        }