?private void pictureBox2_Click(object sender, EventArgs e)? ? ? ? {? ? ? ? ? ?? ? ? ? ? ? Form2 form = new Form2();? ? ? ? ? ? form.ShowDialog();?}//這是第一窗體Form1,點(diǎn)擊pictureBox2即可進(jìn)入窗體Form2;下面是Form1;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;namespace ll{? ? public partial class Form2 : Form? ? {? ? ? ? public Form2()? ? ? ? {? ? ? ? ? ? InitializeComponent();? ? ? ? }? ? ? ? private void label1_Click(object sender, EventArgs e)? ? ? ? {? ? ? ? }? ? ? ? private void axWindowsMediaPlayer1_Enter(object sender, EventArgs e)? ? ? ? {? ? ? ? ??? ? ? ? }? ? ? ? private void button1_Click(object sender, EventArgs e)? ? ? ? {? ? ? ? ? ? if (this.openFileDialog1.ShowDialog() == DialogResult.OK)? ? ? ? ? ? {? ? ? ? ? ? ? ? this.textBox1.Text = this.openFileDialog1.FileName;? ? ? ? ? ? }? ? ? ? }? ? ? ? private void timer1_Tick(object sender, EventArgs e)? ? ? ? {? ? ? ? ? ? if (DateTime.Now.ToShortTimeString() == this.textBox2.Text.Trim().ToString())? ? ? ? ? ? {? ? ? ? ? ? ? ? this.axWindowsMediaPlayer1.URL = this.textBox1.Text; //設(shè)置音樂(lè)文件的播放路徑? ? ? ? ? ? ? ? this.axWindowsMediaPlayer1.Ctlcontrols.play(); //播放多媒體文件? ? ? ? ? ? ? ? this.timer1.Enabled = false; //關(guān)閉timer1計(jì)時(shí)器? ? ? ? ? ? ? ? this.timer2.Enabled = true; //啟動(dòng)timer2計(jì)時(shí)器? ? ? ? ? ? ? ? this.timer2.Interval = 1000; //設(shè)置timer2計(jì)時(shí)器的Tick事件間隔為1s? ? ? ? ? ? ? ? this.Show(); //顯示該窗體? ? ? ? ? ? }? ? ? ? }? ? ? ? private void button2_Click(object sender, EventArgs e)? ? ? ? {? ? ? ? ? ? this.timer1.Enabled = true;? ? ? ? ? ?this.Hide();? ? ? ? ? ? this.ShowInTaskbar = false ?;? ? ? ? }? ? ? ? private void button3_Click(object sender, EventArgs e)? ? ? ? {? ? ? ? ? ? Application.Exit();? ? ? ? }? ? ? ?? ? ? ? private void timer2_Tick(object sender, EventArgs e)? ? ? ? {? ? ? ? ? ? if (this.axWindowsMediaPlayer1.status != "正在播放") //當(dāng)多媒體處于正在播放的狀態(tài)時(shí)? ? ? ? ? ? {? ? ? ? ? ? ? ? this.timer2.Enabled = false; //關(guān)閉timer2計(jì)時(shí)器? ? ? ? ? ? ? ? MessageBox.Show("本次播放已完成,謝謝使用?。。?); //彈出信息提示? ? ? ? ? ? }? ? ? ? }? ? }}//From2是一個(gè)鬧鐘,//問(wèn)題來(lái)了,我這個(gè)鬧鐘Form2如果不通過(guò)Form1進(jìn)入form2設(shè)定時(shí)間是可以用的,但用了多窗體之后鬧鈴不響了
添加回答
舉報(bào)
0/150
提交
取消