Пример #1
0
 public static void DrawRtfText(this Graphics graphics, string rtf, Rectangle layoutArea)
 {
     if (Graphics_DrawRtfText.rtfDrawer == null)
     {
         Graphics_DrawRtfText.rtfDrawer = new RichTextBoxDrawer();
     }
     Graphics_DrawRtfText.rtfDrawer.Rtf = rtf;
     Graphics_DrawRtfText.rtfDrawer.Draw(graphics, layoutArea);
 }
Пример #2
0
 public static void DrawRtfText(this Graphics graphics, string rtf, Rectangle layoutArea)
 {
     if (Graphics_DrawRtfText.rtfDrawer == null)
     {
         Graphics_DrawRtfText.rtfDrawer = new RichTextBoxDrawer();
     }
     Graphics_DrawRtfText.rtfDrawer.Rtf = rtf;
     Graphics_DrawRtfText.rtfDrawer.Draw(graphics, layoutArea);
 }
Пример #3
0
 public static void DrawRtfText(this Graphics graphics, string rtf, Rectangle layoutArea, Color color, Font font)
 {
     if (Graphics_DrawRtfText.rtfDrawer == null) {
     Graphics_DrawRtfText.rtfDrawer = new RichTextBoxDrawer();
       }
       Graphics_DrawRtfText.rtfDrawer.Rtf = rtf;
       Graphics_DrawRtfText.rtfDrawer.ForeColor = color;
       Graphics_DrawRtfText.rtfDrawer.Font = font;
       Graphics_DrawRtfText.rtfDrawer.DetectUrls = false;
       Graphics_DrawRtfText.rtfDrawer.Draw(graphics, layoutArea);
 }
Пример #4
0
 public static void DrawRtfText(this Graphics graphics, string rtf, Rectangle layoutArea, Color color, Font font)
 {
     if (Graphics_DrawRtfText.rtfDrawer == null)
     {
         Graphics_DrawRtfText.rtfDrawer = new RichTextBoxDrawer();
     }
     Graphics_DrawRtfText.rtfDrawer.Rtf        = rtf;
     Graphics_DrawRtfText.rtfDrawer.ForeColor  = color;
     Graphics_DrawRtfText.rtfDrawer.Font       = font;
     Graphics_DrawRtfText.rtfDrawer.DetectUrls = false;
     Graphics_DrawRtfText.rtfDrawer.Draw(graphics, layoutArea);
 }
Пример #5
0
        private static void AppendText(this RichTextBoxDrawer box, string text, Font font)
        {
            int ss = box.TextLength;

            box.AppendText(text);
            box.SelectionStart  = ss;
            box.SelectionLength = text.Length;
            box.SelectionFont   = font;
            if (!font.Bold)
            {
                box.SelectionColor = Color.DimGray;
            }
            else
            {
                box.SelectionColor = Color.Black;
            }
        }
Пример #6
0
        public static void DrawRtfText(this Graphics graphics, string text, string emphasis, Font f, Font bf, Rectangle layoutArea)
        {
            RichTextBoxDrawer rtfDrawer = new RichTextBoxDrawer();

            rtfDrawer.Multiline = true;

            if (Regex.IsMatch(text, emphasis, RegexOptions.IgnoreCase & RegexOptions.CultureInvariant))
            {
                text = Regex.Replace(text, emphasis, "%", RegexOptions.IgnoreCase & RegexOptions.CultureInvariant);
                var parts = text.Split('%');

                rtfDrawer.AppendText(parts[0], f);
                rtfDrawer.AppendText(emphasis, bf);
                rtfDrawer.AppendText(parts[1], f);
            }
            else
            {
                rtfDrawer.AppendText(text, f);
            }

            rtfDrawer.Draw(graphics, layoutArea);
        }