怎么用C#实现信息提示? 就像金山杀毒软件发现病毒时的提示窗体 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 仿MSN写的,楼主看能不能用上,开线程播放声音是和弹出同步的using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Threading;//引用资源类using System.Resources;using System.Reflection;namespace MsnNotify{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } Thread Tpaly = null; private void button1_Click(object sender, EventArgs e)//楼主点一下窗口,就能触发窗口弹出 { //用线程播放声音 Tpaly = new Thread(new ThreadStart(ToPaly)); Tpaly.Start(); string title = "新消息"; string content = "你有新消息请注意查收!"; TaskbarNotifier taskbarNotifier = new TaskbarNotifier(); System.Drawing.Image imgBack= (Image)MsnNotify.Properties.Resources.skin;//从资源文件里得到背景图,你可以自己加一个 taskbarNotifier.SetBackgroundBitmap(imgBack, Color.FromArgb(255, 0, 255));//设置背景图 System.Drawing.Image imgClose = (Image)MsnNotify.Properties.Resources.close;//从资源文件里得到关闭按钮图片 taskbarNotifier.SetCloseBitmap(imgClose, Color.FromArgb(255, 0, 255), new Point(127, 8));//设置关闭按钮 taskbarNotifier.TitleRectangle = new Rectangle(40, 9, 70, 25);//标题位置 taskbarNotifier.ContentRectangle = new Rectangle(8, 41, 133, 68);//文本位置 //taskbarNotifier1.TitleClick+=new EventHandler(TitleClick); taskbarNotifier.ContentClick += new EventHandler(ContentClick); //taskbarNotifier1.CloseClick+=new EventHandler(CloseClick); taskbarNotifier.Show(title, content, 500, 3000, 500);//显示 } private void ContentClick(object obj, EventArgs e) { MessageBox.Show("你点击了文本信息"); } private void ToPaly() { string Sound = Application.StartupPath + "\\msg.wav"; clsPalyWave.Play(Sound); Tpaly.Abort(); } }} WinForm中的特殊窗体效果:渐变窗口和信息提示窗口在WinForm中偶尔会遇到某些特殊效果:比如某个窗口刚开始的时候是完全透明的,随着时间的变化,窗体逐渐不透明,直至完全不透明。这是本文要探讨的窗体效果之一:渐变窗体。还有一种窗体效果:有些软件在某个特定的时间会显示一个提示窗体,这个窗体不是直接显示的,而是慢慢从窗口的最下方向上移动,直至窗体完全显示就不再移动。当我们点击“确定”按钮之后,窗体由从屏幕上逐渐下移,直至完全从屏幕上完全不显示。这也是本文讨论的窗体效果之一:移动提示信息窗口。 自已建个窗体,然后调用API :AnimateWindow[DllImport("user32")]private static extern bool AnimateWindow(IntPtr hwnd,int dwtime,int nflag);//nflag的取值如下public const Int32 AW_HOR_POSITIVE = 0x00000001; //从左到右显示public const Int32 AW_HOR_NEGATIVE = 0x00000002; //从右到左显示public const Int32 AW_VER_POSITIVE = 0x00000004; //从上到下显示public const Int32 AW_VER_NEGATIVE = 0x00000008; //从下到上显示public const Int32 AW_CENTER = 0x00000010; //若使用了AW_HIDE标志,则使窗口向内重叠,即收缩窗口;否则使窗口向外扩展,即展开窗口public const Int32 AW_HIDE = 0x00010000; //隐藏窗口,缺省则显示窗口public const Int32 AW_ACTIVATE = 0x00020000; //激活窗口。在使用了AW_HIDE标志后不能使用这个标志public const Int32 AW_SLIDE = 0x00040000; //使用滑动类型。缺省则为滚动动画类型。当使用AW_CENTER标志时,这个标志就被忽略public const Int32 AW_BLEND = 0x00080000; //透明度从高到低CLOSE_OR_OPEN = AW_ACTIVATE; //打开//CLOSE_OR_OPEN = AW_HIDE; //关闭IntPtr hwnd = this.Handle;//窗口句柄animatewindow(hwnd,200,AW_HOR_POSITIVE|CLOSE_OR_OPEN); //从左向右显示 animatewindow(hwnd,200,AW_HOR_NEGATIVE|CLOSE_OR_OPEN); //从右向左显示 animatewindow(hwnd,200,AW_VER_POSITIVE|CLOSE_OR_OPEN); //从上到下显示 animatewindow(hwnd,200,AW_VER_NEGATIVE|CLOSE_OR_OPEN); //从下到上显示 animatewindow(hwnd,200,AW_SLIDE|AW_HOR_POSITIVE|AW_VER_POSITIVE|CLOSE_OR_OPEN); //左上角伸展 animatewindow(hwnd,200,AW_SLIDE|AW_HOR_POSITIVE|AW_VER_POSITIVE|CLOSE_OR_OPEN); //左下角伸展 animatewindow(hwnd,200,AW_SLIDE|AW_HOR_NEGATIVE|AW_VER_NEGATIVE|CLOSE_OR_OPEN); //右上角伸展 animatewindow(hwnd,200,AW_SLIDE|AW_HOR_NEGATIVE|AW_VER_NEGATIVE|CLOSE_OR_OPEN); //右下角伸展 TaskbarNotifier請問一樓的,上面的是什么意思 x509证书的一个疑问 如何获取App.config中节点的值? winform 怎么设置这个Form不能关闭.... 还是一个简单的问题 如何实现将消息发送给多个用户 用api监控计算机!急啊! winform,c#,datagrid,主从表:从表的DataGridTableStyle不起作用,但是数据显示没有问题,why? 一个new Random的问题,各位高手帮忙一下啊 用什么方法可以实现不断的往DataGrid中添加数据 16位灰度图像灰度值 如何取得绘制控件的图片并保存 我从数据库中取出一些数据,形式诸如:统计/查询/打印/../../../
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
//引用资源类
using System.Resources;
using System.Reflection;
namespace MsnNotify
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Thread Tpaly = null;
private void button1_Click(object sender, EventArgs e)//楼主点一下窗口,就能触发窗口弹出
{
//用线程播放声音
Tpaly = new Thread(new ThreadStart(ToPaly));
Tpaly.Start();
string title = "新消息";
string content = "你有新消息请注意查收!";
TaskbarNotifier taskbarNotifier = new TaskbarNotifier();
System.Drawing.Image imgBack= (Image)MsnNotify.Properties.Resources.skin;//从资源文件里得到背景图,你可以自己加一个
taskbarNotifier.SetBackgroundBitmap(imgBack, Color.FromArgb(255, 0, 255));//设置背景图
System.Drawing.Image imgClose = (Image)MsnNotify.Properties.Resources.close;//从资源文件里得到关闭按钮图片
taskbarNotifier.SetCloseBitmap(imgClose, Color.FromArgb(255, 0, 255), new Point(127, 8));//设置关闭按钮
taskbarNotifier.TitleRectangle = new Rectangle(40, 9, 70, 25);//标题位置
taskbarNotifier.ContentRectangle = new Rectangle(8, 41, 133, 68);//文本位置
//taskbarNotifier1.TitleClick+=new EventHandler(TitleClick);
taskbarNotifier.ContentClick += new EventHandler(ContentClick);
//taskbarNotifier1.CloseClick+=new EventHandler(CloseClick);
taskbarNotifier.Show(title, content, 500, 3000, 500);//显示
}
private void ContentClick(object obj, EventArgs e)
{
MessageBox.Show("你点击了文本信息");
}
private void ToPaly()
{
string Sound = Application.StartupPath + "\\msg.wav";
clsPalyWave.Play(Sound);
Tpaly.Abort();
}
}
}
在WinForm中偶尔会遇到某些特殊效果:比如某个窗口刚开始的时候是完全透明的,随着时间的变化,窗体逐渐不透明,直至完全不透明。这是本文要探讨的窗体效果之一:渐变窗体。还有一种窗体效果:有些软件在某个特定的时间会显示一个提示窗体,这个窗体不是直接显示的,而是慢慢从窗口的最下方向上移动,直至窗体完全显示就不再移动。当我们点击“确定”按钮之后,窗体由从屏幕上逐渐下移,直至完全从屏幕上完全不显示。这也是本文讨论的窗体效果之一:移动提示信息窗口。
private static extern bool AnimateWindow(IntPtr hwnd,int dwtime,int nflag);
//nflag的取值如下
public const Int32 AW_HOR_POSITIVE = 0x00000001; //从左到右显示
public const Int32 AW_HOR_NEGATIVE = 0x00000002; //从右到左显示
public const Int32 AW_VER_POSITIVE = 0x00000004; //从上到下显示
public const Int32 AW_VER_NEGATIVE = 0x00000008; //从下到上显示
public const Int32 AW_CENTER = 0x00000010; //若使用了AW_HIDE标志,则使窗口向内重叠,即收缩窗口;否则使窗口向外扩展,即展开窗口
public const Int32 AW_HIDE = 0x00010000; //隐藏窗口,缺省则显示窗口
public const Int32 AW_ACTIVATE = 0x00020000; //激活窗口。在使用了AW_HIDE标志后不能使用这个标志
public const Int32 AW_SLIDE = 0x00040000; //使用滑动类型。缺省则为滚动动画类型。当使用AW_CENTER标志时,这个标志就被忽略
public const Int32 AW_BLEND = 0x00080000; //透明度从高到低
CLOSE_OR_OPEN = AW_ACTIVATE; //打开
//CLOSE_OR_OPEN = AW_HIDE; //关闭IntPtr hwnd = this.Handle;//窗口句柄animatewindow(hwnd,200,AW_HOR_POSITIVE|CLOSE_OR_OPEN); //从左向右显示
animatewindow(hwnd,200,AW_HOR_NEGATIVE|CLOSE_OR_OPEN); //从右向左显示
animatewindow(hwnd,200,AW_VER_POSITIVE|CLOSE_OR_OPEN); //从上到下显示
animatewindow(hwnd,200,AW_VER_NEGATIVE|CLOSE_OR_OPEN); //从下到上显示 animatewindow(hwnd,200,AW_SLIDE|AW_HOR_POSITIVE|AW_VER_POSITIVE|CLOSE_OR_OPEN); //左上角伸展
animatewindow(hwnd,200,AW_SLIDE|AW_HOR_POSITIVE|AW_VER_POSITIVE|CLOSE_OR_OPEN); //左下角伸展
animatewindow(hwnd,200,AW_SLIDE|AW_HOR_NEGATIVE|AW_VER_NEGATIVE|CLOSE_OR_OPEN); //右上角伸展
animatewindow(hwnd,200,AW_SLIDE|AW_HOR_NEGATIVE|AW_VER_NEGATIVE|CLOSE_OR_OPEN); //右下角伸展
請問一樓的,上面的是什么意思