下载media player 9的sdk和文档,微软网站有
解决方案 »
- 如何用C# 取网页AJAX返回的数据?
- 显示中国所有省级县级城市按A-Z显示,然后对应到页面的A-Z
- sql查询中字段值为null的处理
- 关于ADO.NET中对象的 sqlcommand
- 看了前人的问题,没看懂,自己问:如何加密并解密App.config?
- 关于编写软件的问题
- 请教类的访问
- 菜鸟请教.C#中怎样得到 .ini 里面的数据???
- 我想把Form贴到ListBox的Item中不知道有什么好办法没有
- 【再问线程问题】如果让一个线程运行结束后通知调用程序。
- 如何在水晶报表(Crystal Report)中的设置自定义纸型
- 在线等待:100分求一简单答案.在C#中自己定义了一个类publicFun.cs,问题如下:
不会吧~~~~~能不能给我个实例看看呀?
// The following code executes everytime the click event is fired.
// This provides play/pause functionality when the user clicks
// the "Play" button.
private void btnPlay_Click(object sender, System.EventArgs e)
{ if (Player.playState == WMPPlayState.wmppsPlaying)
{
pause();
}
else
{
playClip();
}
} // When the Click event is fired on the Stop button, the following code
// checks if the Player is playing, and if so, it stops the player,
// sets the value for the progress bar to the start of the current clip
// and updates the UI.
private void btnStop_Click(object sender, System.EventArgs e)
{
if (Player.playState == WMPPlayState.wmppsPlaying)
{
stop();
songTrackBar.Value = ((Clip)clipArray[currentClip]).startSeconds;
updateCurrentPositionText();
}
} // When the Click event is fired on the "Add..." button, the
// open file dialog box opens and any media items that the user
// selects are added into a playlist and clipArray for use by
// the application.
private void btnAddFile_Click(object sender, System.EventArgs e)
{
// Open a File dialog window.
openFileDialog1.ShowDialog(this);
for (int i = 0; i < openFileDialog1.FileNames.Length; i++)
{
// Store songs selected through the file dialog window
// into the "media" playlist.
Playlist.appendItem(Player.newMedia(
openFileDialog1.FileNames.GetValue(i).ToString())); // Add a new clip object to clipArray for every new clip created.
clipArray.Add(new Clip()); // Create a temporary Clip object to make the code more readable.
Clip tempClip = (Clip)clipArray[Playlist.count - 1]; // Assign all the member variables for the current clip object.
tempClip.mediaName = Playlist.get_Item(Playlist.count - 1).name;
tempClip.mediaURL = Playlist.get_Item(Playlist.count - 1).sourceURL;
tempClip.startSeconds = 0;
tempClip.startString = "00:00";
tempClip.endString = Playlist.get_Item(Playlist.count - 1).durationString;
tempClip.endSeconds = (int)(Math.Ceiling(Playlist.get_Item(Playlist.count - 1).duration)); // Update the listbox.
updateClip(Playlist.count - 1);
}
} private void btnStart_Click(object sender, System.EventArgs e)
{
CurrentClip(START);
} private void btnEnd_Click(object sender, System.EventArgs e)
{
CurrentClip(END);
} private void btnUp_Click(object sender, System.EventArgs e)
{
moveSelectedClip(UP);
} private void btnDown_Click(object sender, System.EventArgs e)
{
moveSelectedClip(DOWN);
} private void btnDelete_Click(object sender, System.EventArgs e)
{
deleteSelectedClip();
} private void btnClear_Click(object sender, System.EventArgs e)
{
clearClipList();
} // In the following code, the current media stops playing and the selected clip
// begins playing when the DoubleClick event is fired.
private void bxClipList_DoubleClick(object sender, System.EventArgs e)
{
stop();
playClip();
} // When the Click event is fired on the "Clear Markers" button, the following code
// resets the current clip back to it's default state, and updates the UI.
private void btnClearMarkers_Click(object sender, System.EventArgs e)
{
stop();
SetDefaultState(((Clip)clipArray[bxClipList.SelectedIndex]));
updateClip(bxClipList.SelectedIndex);
updateCurrentPositionText();
bxClipList.SetSelected(currentClip, true);
} // The following code toggles the sequential functionality on and
// off whenever the CheckChanged event is fired in the "Sequential" checkbox.
private void bxSequential_CheckedChanged(object sender, System.EventArgs e)
{
if (bxSequential.Checked)
{
sequential = true;
}
else
{
sequential = false;
}
}