Introduction
In windows world ToolTips are very important from users point of view and
developers used to provide this facility to user. As we know that MFC does
not provide tool tip for a part of window (It provides tool tips for
controls) so this source will help to give tool tip for specified
regions of window. This is very useful for those people who deals with
drawings because through this they can give tool tip to their drawings.
How to use the source code
Include the following files in your project
- WindowTip.h
- WindowTip.cpp
First Create the ToolTip window as soon as you create your parent
window on that you want to display the tool tip
CWindowTip m_MyTip;
m_MyTip.SetDelay(1000);
m_MyTip.CreateTipWnd(this);
Now call ShowTip
function in mouse move of parent window
m_MyTip.ShowTip(point);
And now add as much tips you want to add by using Following method.
1. Create an object of CTipInfo
2. Set region and text for tip using SetReagion
and
SetText
3. Finally add this using AddTip
method of CWindowTip
CTipInfo info(CRect(0, 0, 100, 100),
"Top Left corner of Window");
m_MyTip.AddTip(info);
CRect t_rect;
GetClientRect(&t_rect);
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);
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);
How to use Demo project
- Just double click on ToolTip.exe
- Double click on window to set the ToolTips
- Move the mouse to top left, middle and right corner of window
and wait for a second.
Future Work ...
- Use Region instead of Rectangle
- Provide Font, Pen and Brush customization
- To Give a small link on tip
I am a Software Professional and Currently working in C-DAC (Centre For Development of Advanced Computing). This is a Scientific Socity under ministry of india of Information Technology.
I have completed My B.C.A. Degree with 77% marks, I am certified by microsofr as Microsoft Certified Professional in Visual Basic 6.0(70-176). Currently working on Visual C++ 6.0 and Using MFC support in my Applicaitons.
For Future Studying 3D graphics desinging like OpenGL and DirectX.