Esempio n. 1
0
        private MessageForm(string strMessage, string strTitle, string strExecute, MessageBoxIcon icon, int msecDuration)
        {
            Icon question;
            InitializeComponent();
            Text = strTitle;
            labelMessage.Text = strMessage;
            this.strExecute = strExecute;
            duration = msecDuration;
            labelCounter.Text = (duration / 0x3e8).ToString();
            using(Graphics graphics = labelMessage.CreateGraphics()) {
                SizeF ef = graphics.MeasureString(strMessage, labelMessage.Font, labelMessage.Width);
                int num = ((int)ef.Height) - labelMessage.Height;
                labelMessage.Height = (int)ef.Height;
                panel1.Height += num;
                ClientSize = new Size(ClientSize.Width, ClientSize.Height + num);
                pictureBoxIcon.Size = new Size(0x20, 0x20);
            }
            if(!string.IsNullOrEmpty(this.strExecute)) {
                btnOk.Visible = false;
                btnOk2.Visible = btnCancel.Visible = true;
            }
            switch(icon) {
                case MessageBoxIcon.Question:
                    question = SystemIcons.Question;
                    sound = SystemSounds.Question;
                    break;

                case MessageBoxIcon.Exclamation:
                    question = SystemIcons.Exclamation;
                    sound = SystemSounds.Exclamation;
                    break;

                case MessageBoxIcon.None:
                    question = SystemIcons.Information;
                    sound = null;
                    break;

                case MessageBoxIcon.Hand:
                    question = SystemIcons.Error;
                    sound = SystemSounds.Hand;
                    break;

                default:
                    question = SystemIcons.Asterisk;
                    sound = SystemSounds.Asterisk;
                    break;
            }
            pictureBoxIcon.Image = question.ToBitmap();
        }
Esempio n. 2
0
 public IconMapping(MessageBoxIcon messageBoxIcon, Icon icon, SystemSound systemSound)
 {
     MessageBoxIcon = messageBoxIcon;
     Icon = icon;
     SystemSound = systemSound;
 }
Esempio n. 3
0
 /// <summary>Plays a system sound.</summary>
 /// <param name="systemSound"><see cref="T:System.Media.SystemSound"></see> object representing the system sound to play.</param>
 public static void PlaySystemSound(SystemSound systemSound)
 {
     if (systemSound == null)
     {
         throw new ArgumentNullException("systemSound");
     }
     systemSound.Play();
 }
 /// <summary>
 /// Creates an Audio object that will play the given system sound
 /// </summary>
 /// <param name="sound"></param>
 public Audio(SystemSound sound) {
     this.SystemSound = sound;
 }
Esempio n. 5
0
 /// <summary>    
 /// 播放系统声音    
 /// </summary>    
 public static void PlaySystemSound(SystemSound systemSound);
Esempio n. 6
0
 /// <summary>
 /// Construct a sound view that plays the specified system sound
 /// </summary>
 public SoundView(SystemSound sound)
     : base(1)
 {
     this.DoOnDeploy(c => { sound.Play(); });
 }
 public void PlaySystemSound(SystemSound systemSound)
 {
     if (systemSound == null)
     {
         throw ExceptionUtils.GetArgumentNullException("systemSound");
     }
     systemSound.Play();
 }