zoukankan      html  css  js  c++  java
  • 发送邮件&Timer

    发送邮件: 命名空间(using System.Net.Mail; using System.Net;)

    SmtpClient sm = new SmtpClient("smtp.sina.cn");
    MailAddress from = new MailAddress("18560812711@sina.cn");
    MailAddress to = new MailAddress("928176983@qq.com");
    MailMessage me = new MailMessage(from, to);
    me.Subject = "啦啦阿拉!";
    me.Body = "感谢你使用本系统,服务费免费!";
    NetworkCredential cr = new NetworkCredential("18560812711@sina.cn", "hq1234561");
    sm.Credentials = cr;
    sm.Send(me);

    Timer的应用:如按钮点击后倒计时

    button1.Enabled = false;
    timer1.Enabled = true;
    }
    int a = 10;
    private void timer1_Tick(object sender, EventArgs e)
    {
    a--;
    button1.Text = "倒计时" + a + "秒!";
    if (a == 0)
    {
    button1.Text = "发送";
    button1.Enabled = true;
    timer1.Enabled = false;
    }
    }

    动画效果:

    private void button2_Click(object sender, EventArgs e)
    {
    timer2.Enabled = true;
    }

    private void timer2_Tick(object sender, EventArgs e)
    {
    int x = button2.Location.X;
    int y = button2.Location.Y;
    button2.Location = new Point(x+5, y);
    if (x > 200)
    {
    timer2.Enabled = false;
    }
    }

  • 相关阅读:
    嵌入式系统编程和调试技巧
    使用Kotlin开发Android应用(II):创建新project
    2015 Multi-University Training Contest 2
    C#开发Unity游戏教程之游戏对象的属性变量
    Java开发project师案例-网络日志分析系统
    Flask
    Flask
    Flask
    Flask
    Flask
  • 原文地址:https://www.cnblogs.com/m110/p/7929342.html
Copyright © 2011-2022 走看看