コード例 #1
0
        // This doesn't do exactly what you would think, it just pulls off the \n part of the ending
        internal void DrawEnding(Graphics dc, float y)
        {
            if (document.multiline)
            {
                return;
            }
            LineTag last = tags;

            while (last.Next != null)
            {
                last = last.Next;
            }

            string end_str = null;

            switch (document.LineEndingLength(ending))
            {
            case 0:
                return;

            case 1:
                end_str = "\u0013";
                break;

            case 2:
                end_str = "\u0013\u0013";
                break;

            case 3:
                end_str = "\u0013\u0013\u0013";
                break;
            }

            TextBoxTextRenderer.DrawText(dc, end_str, last.Font, last.Color, X + widths [TextLengthWithoutEnding()] - document.viewport_x + document.OffsetX, y, true);
        }
コード例 #2
0
ファイル: LineTag.cs プロジェクト: SickheadGames/BRUTE.mono
 public virtual void Draw(Graphics dc, Color color, float x, float y, int start, int end)
 {
     if (text_position == TextPositioning.Subscript)
     {
         y += OffsetY;
     }
     TextBoxTextRenderer.DrawText(dc, line.text.ToString(start, end).Replace("\r", string.Empty), FontToDisplay, color, x, y, false);
 }
コード例 #3
0
ファイル: LineTag.cs プロジェクト: SickheadGames/BRUTE.mono
        /// <summary>
        ///
        /// </summary>
        /// <param name="drawStart">0 based start index</param>
        public virtual void Draw(Graphics dc, Color color, float xoff, float y, int drawStart, int drawEnd,
                                 string text, out Rectangle measuredText, bool measureText)
        {
            if (!visible)
            {
                measuredText = new Rectangle();
                return;
            }

            if (text_position == TextPositioning.Subscript)
            {
                y += OffsetY;
            }

            if (measureText)
            {
                int xstart = (int)line.widths [drawStart] + (int)xoff;
                int xend   = (int)line.widths [drawEnd] - (int)line.widths [drawStart];
                int ystart = (int)y;
                int yend   = (int)TextBoxTextRenderer.MeasureText(dc, Text(), FontToDisplay).Height;

                measuredText = new Rectangle(xstart, ystart, xend, yend);
            }
            else
            {
                measuredText = new Rectangle();
            }

            while (drawStart < drawEnd)
            {
                int tab_index = text.IndexOf("\t", drawStart);

                if (tab_index == -1 || tab_index > drawEnd)
                {
                    tab_index = drawEnd;
                }

                TextBoxTextRenderer.DrawText(dc, text.Substring(drawStart, tab_index - drawStart).Replace("\r", string.Empty), FontToDisplay, color, xoff + line.widths [drawStart], y, false);

                // non multilines get the unknown char
                if (!line.document.multiline && tab_index != drawEnd)
                {
                    TextBoxTextRenderer.DrawText(dc, "\u0013", FontToDisplay, color, xoff + line.widths [tab_index], y, true);
                }

                drawStart = tab_index + 1;
            }
        }
コード例 #4
0
 public virtual void Draw(Graphics dc, Color_ color, float x, float y, int start, int end)
 {
     TextBoxTextRenderer.DrawText(dc, line.text.ToString(start, end).Replace("\r", string.Empty), FontToDisplay, color, x, y, false);
 }