public static void AddToRTB(RichTextBox rtb, string strText, StyleType style, enumIcon icon) { switch (style) { case StyleType.bodyBlack: AddToRTB(rtb, strText, Color.Black, 8, false, icon); break; case StyleType.bodyBlackBold: AddToRTB(rtb, strText, Color.Black, 8, true, icon); break; case StyleType.bodyBlue: AddToRTB(rtb, strText, Color.Blue, 8, false, icon); break; case StyleType.bodyBlueBold: AddToRTB(rtb, strText, Color.Blue, 8, true, icon); break; case StyleType.bodyChocolate: AddToRTB(rtb, strText, Color.Chocolate, 8, false, icon); break; case StyleType.bodyChocolateBold: AddToRTB(rtb, strText, Color.Chocolate, 8, true, icon); break; case StyleType.bodyDarkGray: AddToRTB(rtb, strText, Color.DarkGray, 8, false, icon); break; case StyleType.bodyMidnightBlue: AddToRTB(rtb, strText, Color.MidnightBlue, 8, false, icon); break; case StyleType.bodyOrange: AddToRTB(rtb, strText, Color.Orange, 8, false, icon); break; case StyleType.bodyPurple: AddToRTB(rtb, strText, Color.Purple, 8, false, icon); break; case StyleType.bodyRed: AddToRTB(rtb, strText, Color.Red, 8, false, icon); break; case StyleType.bodySeaGreen: AddToRTB(rtb, strText, Color.SeaGreen, 8, false, icon); break; case StyleType.bodySeaGreenBold: AddToRTB(rtb, strText, Color.SeaGreen, 8, true, icon); break; case StyleType.titleBlack: AddToRTB(rtb, strText, Color.Black, 14, true, icon); break; case StyleType.titleBlue: AddToRTB(rtb, strText, Color.Blue, 14, true, icon); break; case StyleType.titleChocolate: AddToRTB(rtb, strText, Color.Chocolate, 14, true, icon); break; case StyleType.titleSeagreen: AddToRTB(rtb, strText, Color.SeaGreen, 14, true, icon); break; default: AddToRTB(rtb, strText, Color.Black, 8, false, icon); break; } }
private static void addIconToRtb(RichTextBox rtb, enumIcon icon) { if (icon != enumIcon.no_icon) { Font font1 = new Font("Wingdings", 10f, FontStyle.Regular, GraphicsUnit.Point, 0); rtb.SelectionStart = rtb.TextLength; rtb.SelectionFont = font1; switch (icon) { case enumIcon.brown_arrow: rtb.SelectionColor = Color.Brown; rtb.SelectedText = asciiToString(182); break; case enumIcon.green_check: rtb.SelectionColor = Color.Green; rtb.SelectedText = asciiToString(252); break; case enumIcon.orange_dotdotdot: rtb.SelectionColor = Color.Orange; rtb.SelectedText = asciiToString(160) + asciiToString(160) + asciiToString(160); break; case enumIcon.red_x: rtb.SelectionColor = Color.Red; rtb.SelectedText = asciiToString(251); break; } } }
private static void addIconToRtb(RichTextBox rtb,enumIcon icon) { if (icon != enumIcon.no_icon) { Font font1 = new Font("Wingdings", 10f, FontStyle.Regular, GraphicsUnit.Point, 0); rtb.SelectionStart = rtb.TextLength; rtb.SelectionFont = font1; switch (icon) { case enumIcon.brown_arrow: rtb.SelectionColor = Color.Brown; rtb.SelectedText = asciiToString(182); break; case enumIcon.green_check: rtb.SelectionColor = Color.Green; rtb.SelectedText = asciiToString(252); break; case enumIcon.orange_dotdotdot: rtb.SelectionColor = Color.Orange; rtb.SelectedText = asciiToString(160) + asciiToString(160) + asciiToString(160); break; case enumIcon.red_x: rtb.SelectionColor = Color.Red; rtb.SelectedText = asciiToString(251); break; } } }
public static void AddToRTB(RichTextBox rtb,string strText, Color textColor, float fontSize, bool bold, enumIcon icon) { if(rtb.InvokeRequired) { rtb.BeginInvoke(new delA(AddToRTB), new object[] { rtb, strText, textColor, fontSize, bold, icon }); return; } FontStyle style1 = bold ? FontStyle.Bold : FontStyle.Regular; if (fontSize <= 0) fontSize = 8; Font font1 = new Font("Courier New", fontSize, style1, GraphicsUnit.Point, 0); rtb.SelectionStart = rtb.TextLength; rtb.SelectionFont = font1; rtb.SelectionColor = textColor; rtb.SelectedText = strText; addIconToRtb(rtb,icon); }
public static void AddToRTB(RichTextBox rtb, string strText, Color textColor, float fontSize, bool bold, enumIcon icon) { if (rtb.InvokeRequired) { rtb.BeginInvoke(new delA(AddToRTB), new object[] { rtb, strText, textColor, fontSize, bold, icon }); return; } FontStyle style1 = bold ? FontStyle.Bold : FontStyle.Regular; if (fontSize <= 0) { fontSize = 8; } Font font1 = new Font("Courier New", fontSize, style1, GraphicsUnit.Point, 0); rtb.SelectionStart = rtb.TextLength; rtb.SelectionFont = font1; rtb.SelectionColor = textColor; rtb.SelectedText = strText; addIconToRtb(rtb, icon); }