GfxOutBarCtrl的问题

b43ok 2006-05-02 01:00:47
如何象qq消息那样让里面的Item闪动起来?
思路我清楚,要么用个timer不停的换图标,要么不停的移动item的位置
就是不知道这代码具体该怎么写.
请赐教!
...全文
142 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
kuanx77 2006-05-03
  • 打赏
  • 举报
回复
楼主是位厚道之人 支持
b43ok 2006-05-03
  • 打赏
  • 举报
回复
我已经自己解决
我帖出来吧,免得后人走弯路

其实 GfxOutBarCtrl已经自己带了这个过程,晕啊!
就是 GfxOutBarCtrl 里的Timer 3 事件,而且有两个函数实现它

void SetAnimationTickCount(const long value)
void SetAnimSelHighlight(const int iTime)

这两个就可以让里面的Item动起来了

void CGfxOutBarCtrl::SetAnimSelHighlight(const int iTime)
{
if (iTime <= 0) KillTimer(3);
else SetTimer(3, iTime, NULL);
iSelAnimTiming = iTime;
}

再看看Timer里
if (nIDEvent == 3 && iLastSel >= 0)
{
iSelAnimCount ++;
if (iSelAnimCount > 10) iSelAnimCount = -1;
if (iSelAnimCount == 0)
DrawAnimItem(-1, 1, iLastSel);
if (iSelAnimCount == 1)
DrawAnimItem(0, 0, iLastSel);
if (iSelAnimCount == 2)
DrawAnimItem(1, 1, iLastSel);
if (iSelAnimCount == 3)
DrawAnimItem(0, 0, iLastSel);
}
哈哈,关键还是用到DrawAnimItem()这个函数
,那么我们完全可以在自己的程序里调用DrawAnimItem()来实现闪动了
它的用法是 DrawAnimItem(横坐标偏移量,纵坐标偏移量,要移动图标的索引值);
不过我用它的时候发现它在定义的时候有点问题
void CGfxOutBarCtrl::DrawAnimItem(const int xoffset, const int yoffset, const int index)
{
CImageList * ima = GetFolderImageList(iSelFolder, IsSmallIconView());

CRect rc, irc;
GetInsideRect(irc);
GetItemRect(iSelFolder, iLastSel, rc);

if (iLastSel >= iFirstItem && irc.bottom > rc.bottom && irc.top < rc.top)
{
……
……
……
}
}
把这个函数里面的所有iLastSel都换成index才不会出错,估计是作者留给我们的一点小陷阱吧
^_^
abuseyoudna1981 2006-05-02
  • 打赏
  • 举报
回复
既然你已经知道思路,就自己去实现呀.我用CTREECTRL,实现过.就是换图片,定时刷新.

15,978

社区成员

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

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