Exemplo n.º 1
0
 public void AddNewLine(int pos)
 {
     SimpleText item = new SimpleText {
         Text = @"\n"
     };
     this.Texts.Insert(pos, item);
 }
Exemplo n.º 2
0
 public void AddNewLine()
 {
     SimpleText item = new SimpleText {
         Text = @"\n"
     };
     this.Texts.Add(item);
 }
Exemplo n.º 3
0
        public void AddText(string text)
        {
            SimpleText item = new SimpleText {
                Text = text
            };

            this.Texts.Add(item);
        }
Exemplo n.º 4
0
        public void AddNewLine(int pos)
        {
            SimpleText item = new SimpleText {
                Text = @"\n"
            };

            this.Texts.Insert(pos, item);
        }
Exemplo n.º 5
0
        public void AddNewLine()
        {
            SimpleText item = new SimpleText {
                Text = @"\n"
            };

            this.Texts.Add(item);
        }
Exemplo n.º 6
0
        public void AddText(int pos, string text, Color color)
        {
            SimpleText item = new SimpleText {
                Text      = text,
                TextColor = color
            };

            this.Texts.Insert(pos, item);
        }
Exemplo n.º 7
0
        public void AddText(string text, Color color)
        {
            SimpleText item = new SimpleText {
                Text      = text,
                TextColor = color
            };

            this.Texts.Add(item);
        }
Exemplo n.º 8
0
        private bool DevideText(int index, int currentWidth)
        {
            SimpleText text;
            string     str       = this.Texts[index].Text;
            int        textWidth = 0;
            int        length    = 1;

            do
            {
                textWidth = GetTextWidth(str.Substring(0, length));  // this.Builder.GetTextWidth(str.Substring(0, length));
                if ((currentWidth + textWidth) >= this.ClientWidth)
                {
                    break;
                }
                length++;
            }while (length <= str.Length);
            if (length > str.Length)
            {
                //暫去掉,待考慮
                //throw new Exception("RichText Width Error.");
            }
            if (length == 1)
            {
                SimpleText local1 = this.Texts[index];
                local1.Row++;
                if (((this.Texts[index].Row + 1) * this.RowHeight) > this.ClientHeight)
                {
                    this.MultiPage        = true;
                    this.Texts[index].Row = 0;
                    this.currentRow       = 0;
                    this.PageIndexs.Add(index + 1);
                }
                return(false);
            }
            text = new SimpleText {
                Text      = str.Substring(length - 1),
                TextColor = this.Texts[index].TextColor,
                Row       = this.Texts[index].Row + 1,
                //TextTexture = this.Builder.CreateTextTexture(text.Text)
                //TextTexture = this.Builder.CreateTextTexture(str.Substring(length - 1))
            };
            this.Texts.Insert(index + 1, text);
            if (((text.Row + 1) * this.RowHeight) > this.ClientHeight)
            {
                this.MultiPage  = true;
                text.Row        = 0;
                this.currentRow = 0;
                this.PageIndexs.Add(index + 1);
            }
            this.Texts[index].Text = str.Substring(0, length - 1);
            //this.Texts[index].TextTexture = this.Builder.CreateTextTexture(this.Texts[index].Text);
            return(true);
        }
Exemplo n.º 9
0
 public void AddText(string text, Color color)
 {
     SimpleText item = new SimpleText {
         Text = text,
         TextColor = color
     };
     this.Texts.Add(item);
 }
Exemplo n.º 10
0
 public void AddText(string text)
 {
     SimpleText item = new SimpleText {
         Text = text
     };
     this.Texts.Add(item);
 }
Exemplo n.º 11
0
 private bool DevideText(int index, int currentWidth)
 {
     SimpleText text;
     string str = this.Texts[index].Text;
     int textWidth = 0;
     int length = 1;
     do
     {
         textWidth = this.Builder.GetTextWidth(str.Substring(0, length));
         if ((currentWidth + textWidth) >= this.ClientWidth)
         {
             break;
         }
         length++;
     }
     while (length <= str.Length);
     if (length > str.Length)
     {
         throw new Exception("RichText Width Error.");
     }
     if (length == 1)
     {
         SimpleText local1 = this.Texts[index];
         local1.Row++;
         if (((this.Texts[index].Row + 1) * this.RowHeight) > this.ClientHeight)
         {
             this.MultiPage = true;
             this.Texts[index].Row = 0;
             this.currentRow = 0;
             this.PageIndexs.Add(index + 1);
         }
         return false;
     }
     text = new SimpleText {
         Text = str.Substring(length - 1),
         TextColor = this.Texts[index].TextColor,
         Row = this.Texts[index].Row + 1,
         //TextTexture = this.Builder.CreateTextTexture(text.Text)
         TextTexture = this.Builder.CreateTextTexture(str.Substring(length - 1))
     };
     this.Texts.Insert(index + 1, text);
     if (((text.Row + 1) * this.RowHeight) > this.ClientHeight)
     {
         this.MultiPage = true;
         text.Row = 0;
         this.currentRow = 0;
         this.PageIndexs.Add(index + 1);
     }
     this.Texts[index].Text = str.Substring(0, length - 1);
     this.Texts[index].TextTexture = this.Builder.CreateTextTexture(this.Texts[index].Text);
     return true;
 }
Exemplo n.º 12
0
 public void AddText(int pos, string text, Color color)
 {
     SimpleText item = new SimpleText {
         Text = text,
         TextColor = color
     };
     this.Texts.Insert(pos, item);
 }