コード例 #1
0
            public static LineToPrint Get(int index, Graphics g, PointF pos,
                                          float width, RichTextBox rtb, ref WordToPrint nextWord, out int nextIndex)
            {
                LineToPrint line = new LineToPrint();

                if (nextWord != null)
                {
                    line.Append(nextWord);
                    pos.X += nextWord.Size.Width;
                }
                nextWord = null;
                int i = index;

                while (i < rtb.Text.Length)
                {
                    WordToPrint word = WordToPrint.Get(i, g, pos, rtb);
                    i += word.Length;
                    if (word.IsLineBreak)
                    {
                        // throw it away?
                        break;
                    }
                    else if (word.Size.Width + line.Size.Width < width)
                    {
                        line.Append(word);
                        pos.X += word.Size.Width;
                    }
                    else
                    {
                        nextWord = word;
                        break;
                    }
                }
                nextIndex = i;
                return(line);
            }
コード例 #2
0
 public static LineToPrint Get(int index, Graphics g, PointF pos, 
     float width, RichTextBox rtb, ref WordToPrint nextWord, out int nextIndex)
 {
     LineToPrint line = new LineToPrint();
     if (nextWord != null)
     {
         line.Append (nextWord);
         pos.X += nextWord.Size.Width;
     }
     nextWord = null;
     int i = index;
     while (i < rtb.Text.Length)
     {
         WordToPrint word = WordToPrint.Get (i, g, pos, rtb);
         i += word.Length;
         if (word.IsLineBreak)
         {
             // throw it away?
             break;
         }
         else if (word.Size.Width + line.Size.Width < width)
         {
             line.Append (word);
             pos.X += word.Size.Width;
         }
         else
         {
             nextWord = word;
             break;
         }
     }
     nextIndex = i;
     return line;
 }