MFC 如何实现窗口右下角弹出一个小框框,就像QQ有用户登录时弹出的那样,大家帮忙给个思路哦。

骑着蜗牛追乌龟 2010-10-27 01:30:00
MFC 如何实现窗口右下角弹出一个小框框
而且颜色能渐渐变淡
如果鼠标移上去的话就又恢复到正常颜色
如果一直不管它,它就自动消失。
就像QQ有用户登录时弹出的那样,
大家帮忙给个思路哦。
...全文
722 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
Sou2012 2010-10-27
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 muzizongheng 的回复:]

开源的和VS自带的都有,如果你用的是VS2008 sp1及以上的, 建议用vc自带的。

CMFCDesktopAlertWnd
[/Quote]

UP.
Eleven 2010-10-27
  • 打赏
  • 举报
回复
可以自己写一个非模态对话框+定时器
muzizongheng 2010-10-27
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 libinfei8848 的回复:]
引用 5 楼 muzizongheng 的回复:
C/C++ code

CMFCDesktopAlertWnd* pPopup = new CMFCDesktopAlertWnd;

// int m_nAnimation
pPopup->SetAnimationType ((CMFCPopupMenu::ANIMATION_TYPE) m_nAnimation);

// in……
[/Quote]

都说了vs2008 sp1及以后都有的。 因此要时刻关心语言的新特性或者新类库。
libinfei8848 2010-10-27
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 muzizongheng 的回复:]
C/C++ code

CMFCDesktopAlertWnd* pPopup = new CMFCDesktopAlertWnd;

// int m_nAnimation
pPopup->SetAnimationType ((CMFCPopupMenu::ANIMATION_TYPE) m_nAnimation);

// int m_nA……
[/Quote]

MFC后来新加的?
muzizongheng 2010-10-27
  • 打赏
  • 举报
回复

CMFCDesktopAlertWnd* pPopup = new CMFCDesktopAlertWnd;

// int m_nAnimation
pPopup->SetAnimationType ((CMFCPopupMenu::ANIMATION_TYPE) m_nAnimation);

// int m_nAnimationSpeed
pPopup->SetAnimationSpeed (m_nAnimationSpeed);

// int m_nTransparency
pPopup->SetTransparency ((BYTE)m_nTransparency);

// BOOL m_bSmallCaption
pPopup->SetSmallCaption (m_bSmallCaption);

// BOOL m_bAutoClose, int m_nAutoCloseTime
pPopup->SetAutoCloseTime (m_bAutoClose ? m_nAutoCloseTime * 1000 : 0);

// int m_nPopupSource
if (m_nPopupSource == 0)
{
// int m_nVisualMngr
// CPoint m_ptPopup
// The this pointer points to a CDesktopAlertDemoDlg class which extends the CDialogEx class.
if (m_nVisualMngr == 5) // MSN-style
{
pPopup->Create (this, IDD_DIALOG2, NULL,
m_ptPopup, RUNTIME_CLASS (CMSNDlg));
}
else
{
pPopup->Create (this, IDD_DIALOG1,
m_menuPopup.GetSubMenu (0)->GetSafeHmenu (),
m_ptPopup, RUNTIME_CLASS (CMyPopupDlg));
}
}
疯狂石头_ 2010-10-27
  • 打赏
  • 举报
回复
http://www.codeproject.com/KB/dialog/taskbarnotifier.aspx
这个有好几个样式,楼主可以试试这个
babala2009 2010-10-27
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 muzizongheng 的回复:]

开源的和VS自带的都有,如果你用的是VS2008 sp1及以上的, 建议用vc自带的。

CMFCDesktopAlertWnd
[/Quote]

没想到MFC这么强大,以前都是自己写的。

这个是一个把窗口放在右下角的例子。你使用timer,吧窗口从下往上挪动就可以了

if (::IsWindow(hWnd))
{
RECT rectClient;
GetWindowRect(&rectClient);
int nWidth = rectClient.right- rectClient.left;
int nHeight = rectClient.bottom- rectClient.top;

RECT rect;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
BOOL bTopMost = 0;;
if (bTopMost)
::SetWindowPos(hWnd, bTopMost ? HWND_TOPMOST : HWND_TOP, rect.right-nWidth, rect.bottom-nHeight, nWidth, nHeight, SWP_NOSIZE);
else
::SetWindowPos(hWnd, bTopMost ? HWND_TOPMOST : HWND_TOP, rect.right-nWidth, rect.bottom-nHeight, nWidth, nHeight, SWP_NOSIZE);
}
muzizongheng 2010-10-27
  • 打赏
  • 举报
回复
开源的和VS自带的都有,如果你用的是VS2008 sp1及以上的, 建议用vc自带的。

CMFCDesktopAlertWnd
野男孩 2010-10-27
  • 打赏
  • 举报
回复
控制在右下角弹出窗口这个总没问题吧??计算下x,y坐标,慢慢从下往上移动显示窗口就行了

颜色淡入淡出好像是用SetLayeredWindowAttributes ,你可以google一下
鼠标移上去会有WM_MOUSEMOVE消息

窗口内设个定时器,没人管的话,定时器被出发了,窗口就退出呗

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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