private void PlayMsgSound(ChxMsgType SoundType) { SoundPlayer player = new SoundPlayer(); switch (SoundType) { case ChxMsgType.Ask: //player.PlayWarnSound(); break; case ChxMsgType.Error: //player.PlayErrSound(); break; case ChxMsgType.None: break; case ChxMsgType.OK: //player.PlayOKSound(); break; default: throw new Exception("無法取得欲播放音效!!"); } }
public FrmMsg(string Title, string Msg, ChxMsgBtnType MsgBtnType, MessageBoxDefaultButton DefaultBtn, string LeftBtn, string RigthBtn, string MiddleBtn, ChxMsgType SoundType) { InitializeComponent(); this.Text = Title; lblMsg.Text = Msg; SetBtns(MsgBtnType, LeftBtn, RigthBtn, MiddleBtn); SetDefaultBtn(MsgBtnType, DefaultBtn); PlayMsgSound(SoundType); }
private static DialogResult ShowMsgMain(string Title, string Text, ChxMsgBtnType MsgBtnType, MessageBoxDefaultButton DefaultBtn, string LeftBtn, string RigthBtn, string MiddleBtn, ChxMsgType SoundType) { Cursor csr = Cursor.Current; Cursor.Current = Cursors.Default; DialogResult diaResultTmp; using (FrmMsg frm = new FrmMsg(Title, Text, MsgBtnType, DefaultBtn, LeftBtn, RigthBtn, MiddleBtn, SoundType)) { frm.TopMost = true; diaResultTmp = frm.ShowDialog(); } Cursor.Current = csr; return(diaResultTmp); }