简单认识C#中的控件
来源:互联网 发布:飞机大战子弹算法 编辑:程序博客网 时间:2024/06/03 15:34
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int i = 1;
int exit = 1;//1代表退出,0代表最小化
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (i==1)
{
DialogResult dr= MessageBox.Show("最小化到托盘?","退出程序?",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
if (dr==DialogResult.Yes)
{
exit = 0;
}
else
{
exit = 1;
}
}
i++;
if (exit==0)
{
e.Cancel = true;
this.WindowState = FormWindowState.Minimized;
//this.Close();
}
else
{
}
}
private void button1_Click(object sender, EventArgs e)
{
i = 3;
exit = 1;
this.Close();
}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Show();
this.Activate();
this.WindowState = FormWindowState.Normal;
}
private void Form1_Resize(object sender, EventArgs e)
{
if (this.WindowState==FormWindowState.Minimized)
{
this.Hide();
//this.notifyIcon1.BalloonTipTitle = "肥牛温馨提示!";
//this.notifyIcon1.BalloonTipText = "这里隐藏了你的肥牛,双击打开";
//this.notifyIcon1.ShowBalloonTip(5000);
this.notifyIcon1.ShowBalloonTip(5000, "肥牛温馨提示!", "在这里", ToolTipIcon.Info);
}
}
private void timer1_Tick(object sender, EventArgs e)
{
if (progressBar1.Value==progressBar1.Maximum)
{
//timer1.Stop();
progressBar1.Value = 0;
}
progressBar1.Value++;
int p = progressBar1.Value * 100 / progressBar1.Maximum;
button1.Text = p + "%";
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Enabled = true;
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int i = 1;
int exit = 1;//1代表退出,0代表最小化
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (i==1)
{
DialogResult dr= MessageBox.Show("最小化到托盘?","退出程序?",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
if (dr==DialogResult.Yes)
{
exit = 0;
}
else
{
exit = 1;
}
}
i++;
if (exit==0)
{
e.Cancel = true;
this.WindowState = FormWindowState.Minimized;
//this.Close();
}
else
{
}
}
private void button1_Click(object sender, EventArgs e)
{
i = 3;
exit = 1;
this.Close();
}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Show();
this.Activate();
this.WindowState = FormWindowState.Normal;
}
private void Form1_Resize(object sender, EventArgs e)
{
if (this.WindowState==FormWindowState.Minimized)
{
this.Hide();
//this.notifyIcon1.BalloonTipTitle = "肥牛温馨提示!";
//this.notifyIcon1.BalloonTipText = "这里隐藏了你的肥牛,双击打开";
//this.notifyIcon1.ShowBalloonTip(5000);
this.notifyIcon1.ShowBalloonTip(5000, "肥牛温馨提示!", "在这里", ToolTipIcon.Info);
}
}
private void timer1_Tick(object sender, EventArgs e)
{
if (progressBar1.Value==progressBar1.Maximum)
{
//timer1.Stop();
progressBar1.Value = 0;
}
progressBar1.Value++;
int p = progressBar1.Value * 100 / progressBar1.Maximum;
button1.Text = p + "%";
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Enabled = true;
}
}
}
设计界面:
- 简单认识C#中的控件
- 对C#的简单认识
- 关于java中的“包”与C#中的“命名空间”的简单认识[转]
- 关于java中的“包”与C#中的“命名空间”的简单认识[转]
- 关于c#中的Timer控件的简单用法
- 关于c#中的Timer控件的简单用法
- 关于c#中的Timer控件的简单用法
- 关于c#中的Timer控件的简单用法
- 关于c#中的Timer控件的简单用法
- 关于微软C#中的Chart图表控件的简单使用
- C#控件简单解读
- 认识Dojo中的界面控件:Dijit
- 认识Dojo中的界面控件:Dijit
- C#中的ComboBox控件
- C#中的ListView控件
- C#中的openFileDialog控件
- C#中的toolStrip控件
- C#中的Textbox控件
- Apache2.2和SVN1.4.4搭建svn版本控制平台(windows环境)
- 构造函数/析构函数
- data line color and utility
- Cracking The Coding Interview--Q1.1
- gbk uf8互换
- 简单认识C#中的控件
- [5月29日的脚本] 检索远程机器上所有本地用户的账户信息 (PowerShell)
- python 3.3 try..catch 小例
- java nio总结
- DOS命令之fc
- 泡沫之夏--我的六月
- PAT 1048
- vbscript中数组维数使用变量的方法
- NEFU 722 Anagram 全排列 STL