窗口上的工具提示

介绍 在windows世界工具提示从用户的角度,是非常重要的 开发人员用来为用户提供此工具。正如我们所知,MFC 不提供工具提示窗口的一部分(它提供了工具提示 源将有助于控制)这给工具提示指定 地区的窗口。这是对那些处理非常有用 图纸,因为通过这个他们可以给他们的图纸工具提示。 如何使用源代码吗 在您的项目包括以下文件 WindowTip.h WindowTip.cpp 首先创建工具提示窗口一旦你创建你的父母 窗口你想显示工具提示 隐藏,复制Code

CWindowTip m_MyTip; // Create the object
m_MyTip.SetDelay(1000); // Set the Display delay
m_MyTip.CreateTipWnd(this); // Create the Window

现在叫ShowTip函数在父窗口的鼠标移动 隐藏,复制Code

m_MyTip.ShowTip(point); // Pass current mouse position

现在增加了提示您想要添加通过使用下面的方法。 1. CTipInfo创建一个对象 2. 设置区域和文本提示使用SetReagion和隐藏,复制Code

SetText

3.最后添加这个使用AddTip CWindowTip的方法 隐藏,复制Code

CTipInfo info(CRect(0, 0, 100, 100),
              "Top Left corner of Window");
m_MyTip.AddTip(info);   

// specifies bottom right corner of window
CRect t_rect;
GetClientRect(&t_rect); // Gets the Parent 
                        // Window Client area
t_rect.top = t_rect.bottom - 100 ;
t_rect.left = t_rect.right - 100 ;
info.SetReagion(t_rect);
info.SetText("Bottom Right corner of Window");
m_MyTip.AddTip(info);

// specifies middle area of window
t_rect.top  = t_rect.bottom / 2 - 50;
t_rect.left = t_rect.right / 2 - 50;
t_rect.bottom = t_rect.top + 100;
t_rect.right = t_rect.left + 100;
info.SetReagion(t_rect);
info.SetText("Middle area of window");
m_MyTip.AddTip(info);

如何使用演示项目吗 只要双击ToolTip.exe双击窗口设置工具提示将鼠标移动到左上角,窗口的中间和右侧的角落 ,等待第二个。 未来的工作…… 使用矩形区域,而不是提供字体,笔和刷定制小链接给小费 本文转载于:http://www.diyabc.com/frontweb/news6710.html

posted @ 2020-08-10 01:45  Dincat  阅读(165)  评论(0编辑  收藏  举报