Ejemplo n.º 1
0
 protected override void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e)
 {
     if (e.KeyChar >= '0' && e.KeyChar <= '9')
     {
         if (SelectionLength > 0)
         {
             Text            = Text.Replace(SelectedText, e.KeyChar.ToString());
             SelectionLength = 0;
             SelectionStart  = 0;
         }
         else
         {
             AppendText(e.KeyChar.ToString());
         }
         SetValue(int.Parse(Text));
         e.Handled = true;
     }
     else if (e.KeyChar >= 32 && e.KeyChar <= 255 && e.KeyChar != 127)
     {
         PInvoke.PlaySound("Asterisk", 0, PInvoke.SND_ASYNC | PInvoke.SND_NOWAIT | PInvoke.SND_ALIAS);
         e.Handled = true;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Play a wave file (called when the planetary hour has changed if the user has configured it)
 /// </summary>
 public void PlaySoundFile(string name)
 {
     PInvoke.PlaySound(name, 0, PInvoke.SND_ASYNC | PInvoke.SND_NOWAIT | PInvoke.SND_FILENAME);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Play a sound alias, such as "Windows Logon"; called when the planetary hour has changed if the user has configured it
 /// </summary>
 public void PlaySoundAlias(string name)
 {
     PInvoke.PlaySound(name, 0, PInvoke.SND_ASYNC | PInvoke.SND_NOWAIT | PInvoke.SND_ALIAS);
 }