how-do-i-generate-a-random-int-number
Random rnd = new Random();int month = rnd.Next(1, 13); // month: >= 1 and < 13
chart library
- https://www.codeproject.com/Articles/5431/A-flexible-charting-library-for-NET
- http://zedgraph.sourceforge.net/samples.html
WindowsMediaPlayer pause
AxWindowsMediaPlayer1.Ctlcontrols.pause()implement-keyboard-shortcuts-in-a-windows-forms-application
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {if (keyData == (Keys.Control | Keys.F)) {
MessageBox.Show("What the Ctrl+F?");
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
play-video-files
// [ C# ]WMPLib.WindowsMediaPlayer Player;
private void PlayFile(String url)
{
Player = new WMPLib.WindowsMediaPlayer();
Player.PlayStateChange +=
new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange);
Player.MediaError +=
new WMPLib._WMPOCXEvents_MediaErrorEventHandler(Player_MediaError);
Player.URL = url;
Player.controls.play();
}
private void Form1_Load(object sender, System.EventArgs e)
{
// TODO Insert a valid path in the line below.
PlayFile(@"c:\myaudio.wma");
}
private void Player_PlayStateChange(int NewState)
{
if ((WMPLib.WMPPlayState)NewState == WMPLib.WMPPlayState.wmppsStopped)
{
this.Close();
}
}
private void Player_MediaError(object pMediaObject)
{
MessageBox.Show("Cannot play media file.");
this.Close();
}
//http://msdn.microsoft.com/en-us/library/dd564582(VS.85).aspx
//https://www.codeproject.com/Articles/844451/Audio-and-Video-Player-Csharp-Winform
留言
張貼留言