浮动气球提示的效果怎样实现?

LixingTie 2006-03-17 07:45:38
就像XP发现新硬件时任务栏弹出的小提示一样,怎样实现的?
...全文
339 25 打赏 收藏 转发到动态 举报
写回复
用AI写文章
25 条回复
切换为时间正序
请发表友善的回复…
发表回复
暗石绿 2006-05-29
  • 打赏
  • 举报
回复
Codeproject 上有一个例子的。
我下载过。

sonyicn 2006-05-28
  • 打赏
  • 举报
回复
mark
xjliang007 2006-03-18
  • 打赏
  • 举报
回复
有時間看看
sx_lxh 2006-03-18
  • 打赏
  • 举报
回复
关注
manplus 2006-03-18
  • 打赏
  • 举报
回复
mark
LixingTie 2006-03-18
  • 打赏
  • 举报
回复
解决了......这帖没人有正确的回答,吼吼~~~~~~帖照结!!!!
http://community.csdn.net/Expert/topic/4620/4620453.xml?temp=.5346949
fine06 2006-03-18
  • 打赏
  • 举报
回复
有時間看看
-渔民- 2006-03-17
  • 打赏
  • 举报
回复
mark
LixingTie 2006-03-17
  • 打赏
  • 举报
回复
汗~~~答非所问!
lih163 2006-03-17
  • 打赏
  • 举报
回复
学习
zlz_212 2006-03-17
  • 打赏
  • 举报
回复
抄得。没有做任何修改,需要你自己改写
zlz_212 2006-03-17
  • 打赏
  • 举报
回复
二、QQ淡出淡出显示实现
  其实用到一个API函数:AnimateWindow,下面是这个函数的一些说明:
The AnimateWindow function enables you to produce special effects when showing or hiding windows.
There are two types of animation: roll animation and slide animation.
BOOL AnimateWindow(
HWND hwnd, // handle to the window to animate
DWORD dwTime, // duration of animation
DWORD dwFlags // animation type
);
上面的函数前两个参数一看就明白,不用说了,最后一个参数dwFlags设置动画窗口的样式:
Specifies the type of animation. This parameter can be one or more of the following flags.
各种标志说明:
标志 说明
AW_SLIDE Uses slide animation. By default, roll animation is used.
This flag is ignored when used with the AW_CENTER flag.
AW_ACTIVATE Activates the window. Do not use this flag with AW_HIDE.
AW_BLEND Uses a fade effect. This flag can be used only if hwnd is a top-level window.
AW_HIDE Hides the window. By default, the window is shown.
AW_CENTER Makes the window appear to collapse inward if the AW_HIDE flag is used or expand outward
if the AW_HIDE flag is not used.
AW_HOR_POSITIVE Animate the window from left to right. This flag can be used with roll or slide animation.
It is ignored when used with the AW_CENTER flag.
AW_HOR_NEGATIVE Animate the window from right to left. This flag can be used with roll or slide animation.
It is ignored when used with the AW_CENTER flag.
AW_VER_POSITIVE Animate the window from top to bottom. This flag can be used with roll or slide animation.
It is ignored when used with the AW_CENTER flag.
AW_VER_NEGATIVE Animate the window from bottom to top. This flag can be used with roll or slide animation.
It is ignored when used with the AW_CENTER flag.
以上内容是从MSDN中摘录的,要淡入淡出的效果的话,用到AW_BELND。
三、控制窗口显示的代码
CMainFrame::OnCreate(…)
{
//...
AnimateWindow(GetSafeHwnd(),1000,AW_CENTER|AW_BLEND);
//…
}
四、关闭的代码
CMainFrame::OnClose(..)
{
AnimateWindow(GetSafeHwnd(),1000,AW_HIDE|AW_CENTER|AW_BLEND);
}
  其实AnimateWindow只是利用了windows本身的方法,如果您要更加有个性的窗口效果,那就得多做写些代码了,一分辛苦,一分收获吧
zlz_212 2006-03-17
  • 打赏
  • 举报
回复
一、MSN拉帘式窗口制作
分三部分:1、窗口的显示;2、窗口的停留;3、窗口的消失;
如果达到这样郊果,系统中要有三个定时器,进行分别控制。定义的定时器如下:
#define ID_TIMER_POP_WINDOW 1
#define ID_TIMER_DISPALY_DELAY 2
#define ID_TIMER_CLOSE_WINDOW 3
  从CWnd 继承一个窗口,当然也可以从CFrameWnd进行派生,这不是主要问题,关键是看你是怎么处理WM_PAINT,WM_MOUSEMOVE,WM_TIMER的消息。一般情况,我从OnPaint()中进行显示图片,在WM_TIMER中处理定时器消息,下面是处里定时器时用到的代码:
CMsgWnd::CMsgWnd()
{
...
SetTimer(ID_TIEMR_POP_WINDOW,20,NULL);
...
}
void CMsgWnd::OnTimer(UINT nIDEvent)
{
static int nHeight=0;
int cy=GetSystemMetrics(SM_CYSCREEN);
int cx=GetSystemMetrics(SM_CXSCREEN);
RECT rect;
SystemParametersInfo(SPI_GETWORKAREA,0,&rect,0);
int y=rect.bottom-rect.top;
int x=rect.right-rect.left;
x=x-WIN_WIDTH;

switch(nIDEvent)
{
case ID_TIMER_POP_WINDOW:
if(nHeight<=WIN_HEIGHT)
{
++nHeight;
MoveWindow(x,
y-nHeight,
WIN_WIDTH,
WIN_HEIGHT);

Invalidate(FALSE);
}
else
{
KillTimer(ID_TIMER_POP_WINDOW);
SetTimer(ID_TIMER_DISPLAY_DELAY,5000,NULL);
}
break;
case ID_TIMER_CLOSE_WINDOW:
if(nHeight>=0)
{
nHeight--;
MoveWindow(x,
y-nHeight,
WIN_WIDTH,
nHeight);
}
else
{
KillTimer(ID_TIMER_CLOSE_WINDOW);
SendMessage(WM_CLOSE);
}
break;
case ID_TIMER_DISPLAY_DELAY:
KillTimer(ID_TIMER_DISPLAY_DELAY);
SetTimer(ID_TIMER_CLOSE_WINDOW,20,NULL);
break;
}

CWnd::OnTimer(nIDEvent);
}
根据你设的定时器的长短来控制窗口的显示过程;
LixingTie 2006-03-17
  • 打赏
  • 举报
回复
上面的代码运行不了啊!!
fantasizeroom 2006-03-17
  • 打赏
  • 举报
回复
上面那个是不是 就是那个程序的啊
quanyi 2006-03-17
  • 打赏
  • 举报
回复
关注
暗石绿 2006-03-17
  • 打赏
  • 举报
回复
mark 一下

以前记得有过这方面的例子的,居然找不到了现在。
LixingTie 2006-03-17
  • 打赏
  • 举报
回复
谁可以帮我做个例子吗!!!先谢谢了
LixingTie 2006-03-17
  • 打赏
  • 举报
回复
查不到 :(
20011521 2006-03-17
  • 打赏
  • 举报
回复
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;

namespace WindowsApplication6
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;

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.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(136, 200);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
public class Win32
{
[DllImport("user32.dll", CharSet=CharSet.Unicode,
ExactSpelling=true)]
public static extern int MessageBoxW(int hWnd, String text, String
caption, uint type);
[DllImport("user32.dll", CharSet=CharSet.Unicode,
ExactSpelling=true)]
public static extern bool FlashWindow(IntPtr hwnd, bool bInvert);

}

private void button1_Click(object sender, System.EventArgs e)
{
// System.Runtime.InteropServices.DllImport("user32.dll")
// static extern bool FlashWindow(IntPtr hwnd, bool bInvert)
// {
//
// }
Win32.MessageBoxW (0,"Kkjkskdjf","kjdkk",0);
Win32.FlashWindow( ,true);//IntPtr hwnd你自己找找看现在没有时间弄这个

}
}
}
加载更多回复(5)

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧