資源簡介
C#源碼,基于TCP/IP 的通信server和client的簡單實例 ,基于winform,適合新手下載學習體會,親測可用。 平臺vs2013

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
using?System.IO;
using?System.Media;
namespace?_01復習
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????//用來存儲音樂文件的全路徑
????????List?listSongs?=?new?List();
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????OpenFileDialog?ofd?=?new?OpenFileDialog();
????????????ofd.title?=?“請選擇音樂文件“;
????????????ofd.InitialDirectory?=?@“C:\Users\SpringRain\Desktop\Music“;
????????????ofd.Multiselect?=?true;
????????????ofd.Filter?=?“音樂文件|*.wav|所有文件|*.*“;
????????????ofd.ShowDialog();
????????????//獲得我們在文件夾中選擇所有文件的全路徑
????????????string[]?path?=?ofd.FileNames;
????????????for?(int?i?=?0;?i?????????????{
????????????????//將音樂文件的文件名加載到ListBox中
????????????????listBox1.Items.Add(Path.GetFileName(path[i]));
????????????????//將音樂文件的全路徑存儲到泛型集合中
????????????????listSongs.Add(path[i]);
????????????}
????????}
????????///?
????????///?實現雙擊播放
????????///?
????????///?
????????///?
????????///?
????????SoundPlayer?sp?=?new?SoundPlayer();
????????private?void?listBox1_DoubleClick(object?sender?EventArgs?e)
????????{
???????????
????????????sp.SoundLocation=listSongs[listBox1.SelectedIndex];
????????????sp.Play();
????????}
????????///?
????????///?點擊下一曲
????????///?
????????///?
????????///?
????????private?void?button3_Click(object?sender?EventArgs?e)
????????{
????????????//獲得當前選中歌曲的索引
????????????int?index?=?listBox1.SelectedIndex;
????????????index++;
????????????if?(index?==?listBox1.Items.Count)
????????????{
????????????????index?=?0;
????????????}
????????????//將改變后的索引重新的賦值給我當前選中項的索引
????????????listBox1.SelectedIndex?=?index;
????????????sp.SoundLocation?=?listSongs[index];
????????????sp.Play();
????????}
????????///?
????????///?點擊上一曲
????????///?
????????///?
????????///?
????????private?void?button2_Click(object?sender?EventArgs?e)
????????{
????????????int?index?=?listBox1.SelectedIndex;
????????????index--;
????????????if?(index?0)
????????????{
????????????????index?=?listBox1.Items.Count-1;
????????????}
????????????//將重新改變后的索引重新的賦值給當前選中項
????????????listBox1.SelectedIndex?=?index;
????????????sp.SoundLocation?=?listSongs[index];
????????????sp.Play();
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3797??2014-05-26?09:03??0505.Net基礎\01復習\01復習.csproj
?????文件????????187??2014-05-26?09:00??0505.Net基礎\01復習\App.config
?????文件??????10240??2014-05-26?09:39??0505.Net基礎\01復習\bin\Debug\01復習.exe
?????文件????????187??2014-05-26?09:00??0505.Net基礎\01復習\bin\Debug\01復習.exe.config
?????文件??????26112??2014-05-26?09:39??0505.Net基礎\01復習\bin\Debug\01復習.pdb
?????文件??????24224??2017-08-11?20:02??0505.Net基礎\01復習\bin\Debug\01復習.vshost.exe
?????文件????????187??2014-05-26?09:00??0505.Net基礎\01復習\bin\Debug\01復習.vshost.exe.config
?????文件????????490??2017-03-19?05:00??0505.Net基礎\01復習\bin\Debug\01復習.vshost.exe.manifest
?????文件???????3076??2014-05-26?09:36??0505.Net基礎\01復習\Form1.cs
?????文件???????3922??2014-05-26?09:35??0505.Net基礎\01復習\Form1.Designer.cs
?????文件???????5817??2014-05-26?09:35??0505.Net基礎\01復習\Form1.resx
?????文件???????2428??2017-08-11?20:03??0505.Net基礎\01復習\obj\Debug\01復習.csproj.FileListAbsolute.txt
?????文件????????977??2014-05-26?09:36??0505.Net基礎\01復習\obj\Debug\01復習.csproj.GenerateResource.Cache
?????文件???????2211??2014-05-26?09:03??0505.Net基礎\01復習\obj\Debug\01復習.csprojResolveAssemblyReference.cache
?????文件??????10240??2014-05-26?09:39??0505.Net基礎\01復習\obj\Debug\01復習.exe
?????文件??????26112??2014-05-26?09:39??0505.Net基礎\01復習\obj\Debug\01復習.pdb
?????文件????????865??2014-05-26?09:00??0505.Net基礎\01復習\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????8047??2017-08-11?20:02??0505.Net基礎\01復習\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件??????????0??2014-05-26?09:00??0505.Net基礎\01復習\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件??????????0??2014-05-26?09:00??0505.Net基礎\01復習\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件??????????0??2014-05-26?09:00??0505.Net基礎\01復習\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
?????文件????????180??2014-05-26?09:36??0505.Net基礎\01復習\obj\Debug\_01復習.Form1.resources
?????文件????????180??2014-05-26?09:03??0505.Net基礎\01復習\obj\Debug\_01復習.Properties.Resources.resources
?????文件????????521??2014-05-26?09:00??0505.Net基礎\01復習\Program.cs
?????文件???????1340??2014-05-26?09:00??0505.Net基礎\01復習\Properties\AssemblyInfo.cs
?????文件???????2870??2014-05-26?09:00??0505.Net基礎\01復習\Properties\Resources.Designer.cs
?????文件???????5612??2014-05-26?09:00??0505.Net基礎\01復習\Properties\Resources.resx
?????文件???????1096??2014-05-26?09:00??0505.Net基礎\01復習\Properties\Settings.Designer.cs
?????文件????????249??2014-05-26?09:00??0505.Net基礎\01復習\Properties\Settings.settings
?????文件???????2595??2014-05-26?09:37??0505.Net基礎\02線程和進程的復習\02線程和進程的復習.csproj
............此處省略205個文件信息
- 上一篇:ASP.NET在線心理測試系統
- 下一篇:Asp.net在線考試系統源碼
評論
共有 條評論