So after extensive research, already I take F3 as key support! I have this:
Code:
private DateTime t1;
private bool isKeyDown = false;
private void textBox2_KeyDown (object sender, KeyEventArgs e)
{
if (!isKeyDown && e.KeyCode == Keys.F3)
{
isKeyDown = true;
t1 = DateTime.Now;
}
}
private void textBox2_KeyUp (object sender, KeyEventArgs e)
{
if (isKeyDown)
{
isKeyDown = false;
WriteCode (sender, DateTime.Now - t1);
}
}
private void WriteCode (object sender, TimeSpan tps)
{
String toWrite;
if (tps.TotalMilliseconds >= 1000)
toWrite = "-";
else
toWrite = "."
textBox2.Text = toWrite;
}
Bookmarks