Draw String's Hotkey : Hotkey « 2D « C# / CSharp Tutorial






Draw String's Hotkey
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Text;    //  necessary for HotkeyPrefix

public class DrawStringHotkey : Form
{
  public DrawStringHotkey()
  {
    ResizeRedraw = true;

  }

  protected override void OnPaint(PaintEventArgs e)
  {
    base.OnPaint(e);
    Graphics g = e.Graphics;
    StringFormat fmt = new StringFormat();
    fmt.Alignment = StringAlignment.Center;
    fmt.HotkeyPrefix = HotkeyPrefix.Show;

    Brush b = new SolidBrush(ForeColor);
    g.DrawString("&Do It!", Font, b, ClientSize.Width / 2, 50, fmt);
  }

  static void Main() 
  {
    Application.Run(new DrawStringHotkey());
  }
}








27.13.Hotkey
27.13.1.Draw String's HotkeyDraw String's Hotkey