Mega Code Archive

 
Categories / C# / 2D Graphics
 

Hotkey Prefix

using System; using System.Drawing; using System.Drawing.Text; using System.Windows.Forms;     class UnderlinedText: Form {      public static void Main()      {           Application.Run(new UnderlinedText());      }      public UnderlinedText()      {           Text = "Underlined Text Using HotkeyPrefix";           Font = new Font("Times New Roman", 14);           ResizeRedraw = true;       }      protected override void OnPaint(PaintEventArgs pea)      {           DoPage(pea.Graphics, ForeColor,ClientSize.Width, ClientSize.Height);      }           protected void DoPage(Graphics grfx, Color clr, int cx, int cy)      {           string       str    = "This is some &u&n&d&e&r&l&i&n&e&d text!";           StringFormat strfmt = new StringFormat();               strfmt.HotkeyPrefix = HotkeyPrefix.Show;               grfx.DrawString(str, Font, new SolidBrush(clr), 0, 0, strfmt);      } }