给Winform 程序学习
为窗体添加皮肤:
public Form1() { InitializeComponent(); this.skinEngine1.SkinFile = "Calmness.ssk"; this.skinEngine1.SkinFile = "GlassBrown.ssk"; this.skinEngine1.SkinFile = "Page.ssk"; this.skinEngine1.SkinFile = "PageColor1.ssk"; this.skinEngine1.SkinFile = "SteelBlack.ssk"; }
必须将skinEngine这个控件添加到你的窗体上,并且把ssk文件放到你EXE文件的根目录下;
添加声音:
SoundPlayer player = new SoundPlayer(); player.SoundLocation = "10123275151.wav"; player.PlaySync();声音文件必须放在EXE所在的目录下;
邮件发送:
namespace cdm.Stmp.Email { class Program { static void Main(string[] args) { MailMessage message = new MailMessage("自己的电子邮件", "接收人的EMAIL"); message.Subject = ".NET Email seed Demo"; message.Body = "我写的这个东西"; try { SmtpClient smtp = new SmtpClient("自己邮件服务器"); smtp.Credentials = new MailCredential("自己的电子邮件", "邮件密码"); smtp.Send(message); } catch (Exception ex) { Console.Write(ex.ToString()); } } } public class MailCredential:ICredentialsByHost { string username = ""; string userpwd = ""; public MailCredential(string name, string pwd) { this.username = name; this.userpwd = pwd; } #region ICredentialsByHost 成员 public NetworkCredential GetCredential(string host, int port, string authenticationType) { NetworkCredential nc = new NetworkCredential(username,userpwd); return nc; } #endregion } }