1.winform如何实现像MSN或QQ那样,在屏幕的右下方弹出某某人刚刚登陆的提示信息框,并且点击信息框中的连接会打开相应的网站,并且信息框在一定时间内自动消失!!!
2.还有像MSN那样,点关闭按钮不会退出程序,而是在任务栏右侧显示一个该应用程序的图标,点击图标会打开应用程序的窗口。
解决其中一个问题也给分,给代码也行,给方法也行,谢谢您!!
2.还有像MSN那样,点关闭按钮不会退出程序,而是在任务栏右侧显示一个该应用程序的图标,点击图标会打开应用程序的窗口。
解决其中一个问题也给分,给代码也行,给方法也行,谢谢您!!
解决方案 »
- Visual studio IDE 如何点一下自动设置初始项目,在哪里设置?
- 我想保存设置信息,如何实现呢?比如窗体的上一次的搜索文本等
- LINQ TO SQL,同一个连接怎么能够查询数据库的最新数据
- aspx和asp的URL通讯问题,在线等..
- 怎样通过web service显示远程文件目录??请高手指教
- 如何知道 new 了多少个子窗体,每个子窗体的名称是什么?
- 点击一个按钮,出现一个Canvas,怎么实现不点按钮,不点Canvas,让这个Canvas不显示?
- webform中创建了tcplistener ,但是客户端连不上
- 简单的出错问题??
- 如何接收POP3邮件?
- 请问一下这两个VC函数在C#中对应的操作是什么呢?
- 求助for循环问题,大家帮忙看看
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
e.e.Cancel = true;
}
protected override void WndProc(ref Message m)
{
const int WM_SYSCOMMAND = 0x0112;
const int SC_CLOSE = 0xF060;
const int SC_MINIMIZE = 0xF020; if (m.Msg == WM_SYSCOMMAND && ((int)m.WParam == SC_MINIMIZE || (int)m.WParam == SC_CLOSE))
{
//最小化到系统栏
this.Hide();
return;
}
base.WndProc(ref m);
}任务栏右侧显示一个该应用程序的图标
用NotifyIcon控件
*****************************************************************************
欢迎使用CSDN论坛阅读器 : CSDN Reader(附全部源代码)
http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html
form1放一個button,裡面寫入
private void Send_Click(object sender, System.EventArgs e)
{
Form2 temp = new Form2();
temp.HeightMax=134;
temp.WidthMax=150;
temp.ScrollShow();
}
form2代碼如下;
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;namespace relax
{
/// <summary>
/// Form2 的摘要描述。
/// </summary>
public class Form2 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Timer timer2; private string information;
private int heightMax,widthMax;
private System.Windows.Forms.Label message; public int HeightMax
{
set{ heightMax=value;}
get{ return heightMax;}
} public int WidthMax
{
set{ widthMax=value;}
get{ return widthMax;}
} public void ScrollShow()
{
message.Text = "一小時了,該休息了!";
this.Show();
this.Width=widthMax;
this.Height=0;
this.timer1.Enabled=true;
} private void ScrollUp()
{
if(Height < heightMax)
{
this.Height += 3;
this.Location = new Point( this.Location.X, this.Location.Y-3 );
}
else
{
this.timer1.Enabled=false;
}
} private void ScrollDown()
{
if(Height > 3 )
{
this.Height -= 3;
this.Location = new Point(this.Location.X, this.Location.Y+3);
}
else
{
this.timer2.Enabled=false;
this.Dispose();
}
} private System.ComponentModel.IContainer components; public Form2()
{
//
// Windows Form 設計工具支援的必要項
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 呼叫之後加入任何建構函式程式碼
//
} /// <summary>
/// 清除任何使用中的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows Form 設計工具產生的程式碼
/// <summary>
/// 此為設計工具支援所必須的方法 - 請勿使用程式碼編輯器修改
/// 這個方法的內容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.button1 = new System.Windows.Forms.Button();
this.message = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.timer2 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(136, 0);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(16, 16);
this.button1.TabIndex = 0;
this.button1.Text = "x";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// message
//
this.message.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(255)), ((System.Byte)(192)));
this.message.Location = new System.Drawing.Point(16, 16);
this.message.Name = "message";
this.message.Size = new System.Drawing.Size(120, 104);
this.message.TabIndex = 1;
this.message.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// timer2
//
this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
//
// Form2
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(192)), ((System.Byte)(128)));
this.ClientSize = new System.Drawing.Size(152, 136);
this.Controls.Add(this.message);
this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "Form2";
this.ShowInTaskbar = false;
this.Text = "Form2";
this.TopMost = true;
this.Load += new System.EventHandler(this.Form2_Load);
this.ResumeLayout(false); }
#endregion private void Form2_Load( object sender, System.EventArgs e )
{
Screen[] screens=Screen.AllScreens;
Screen screen=screens[0];
this.Location = new Point(screen.WorkingArea.Width-widthMax, screen.WorkingArea.Height);
} private void timer1_Tick( object sender, System.EventArgs e )
{
ScrollUp();
} private void timer2_Tick( object sender, System.EventArgs e )
{
ScrollDown();
} private void button1_Click( object sender, System.EventArgs e )
{
timer1.Enabled=false;
timer2.Enabled=true;
} }
}
第二个问题:Closing事件中写代码,实现托盘图标