程序运行时托盘,当计时器到时,显示一个新个窗体,可是窗体显示出不出来?

解决方案 »

  1.   

    程序运行时,就像QQ一样,显示在右下角任务栏上,当到一定的时间时,显示一个窗体,用showdialog()来显示的,可是显示不出啊?
      

  2.   

    private void timer1_Tick(object sender, System.EventArgs e)
    {
    this.timer1.Stop();
    Form2 thisFrm=new Form2();
    thisFrm.ShowDialog();
    this.timer1.Start();
    } private void Form1_Load(object sender, System.EventArgs e)
    {
    this.timer1.Interval=60000 //1分钟
    this.timer1.Start();
    }
      

  3.   

    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;namespace WindowsApplication1
    {
    /// <summary>
    /// Form1 的摘要说明。
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
    private System.Windows.Forms.Timer timer1;
    private System.Windows.Forms.NotifyIcon notifyIcon1;
    private System.ComponentModel.IContainer components; public Form1()
    {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if (components != null) 
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows 窗体设计器生成的代码
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    this.components = new System.ComponentModel.Container();
    System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
    this.timer1 = new System.Windows.Forms.Timer(this.components);
    this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
    // 
    // timer1
    // 
    this.timer1.Interval = 60000;
    this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
    // 
    // notifyIcon1
    // 
    this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
    this.notifyIcon1.Text = "notifyIcon1";
    this.notifyIcon1.Visible = true;
    // 
    // Form1
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(292, 266);
    this.Name = "Form1";
    this.ShowInTaskbar = false;
    this.Text = "Form1";
    this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
    this.Load += new System.EventHandler(this.Form1_Load); }
    #endregion /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main() 
    {
    Application.Run(new Form1());
    } private void timer1_Tick(object sender, System.EventArgs e)
    {
    this.timer1.Stop();
    Form2 thisFrm=new Form2();
    thisFrm.ShowDialog();
    this.timer1.Start();
    } private void Form1_Load(object sender, System.EventArgs e)
    {
    this.timer1.Interval=60000; //1分钟
    this.timer1.Start();

    }
    }
    }