• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

c#windows多窗体

private void pictureBox2_Click(object sender, EventArgs e)
        {
           
            Form2 form = new Form2();
            form.ShowDialog();
}
//这是第一窗体Form1,点击pictureBox2即可进入窗体Form2;下面是Form1;
104003hb9lbb3lcili9wwa.jpg

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;                 //设置音乐文件的播放路径
                this.axWindowsMediaPlayer1.Ctlcontrols.play();                         //播放多媒体文件
                this.timer1.Enabled = false;                 //关闭timer1计时器
                this.timer2.Enabled = true;                 //启动timer2计时器
                this.timer2.Interval = 1000;                 //设置timer2计时器的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 != "正在播放")                        //当多媒体处于正在播放的状态时
            {
                this.timer2.Enabled = false;                 //关闭timer2计时器
                MessageBox.Show("本次播放已完成,谢谢使用!!!");                //弹出信息提示
            }
        }
    }
}
//From2是一个闹钟,
104016wm99voojbmx9g22g.jpg

//问题来了,我这个闹钟Form2如果不通过Form1进入form2设定时间是可以用的,但用了多窗体之后闹铃不响了

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

发新帖

发布任务需求已有1031169位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!