Click here to Skip to main content
13,090,426 members (52,247 online)
Click here to Skip to main content
Add your own
alternative version


9 bookmarked
Posted 17 Sep 2007

Simple tooltip show any place

, 17 Sep 2007
Rate this:
Please Sign up or sign in to vote.
show tooltip in any position, and set text color, back color.
Screenshot - Demo.jpg


you can you use it in any window and any place , show ToolTip information in any time. just it's simple, but for you any customized.


when I wrote the code , my project will delay in each component can show tips(so common, segment Number etc.), so I search tooltip in "codeproject" , but nothing is useful. I still discover some code and use it .

Using the code

how to using C_ColorToolTip in your project?

step 1: Declare the C_colorTooltip object in CView.

//  declare the Tooltip object in CView
//  C_ColorToolTip m_Tips;//

step 2: Create the C_ColorTooltip object

CColrView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
 if (CView::OnCreate(lpCreateStruct) == -1)
  return -1;
 // Create the tooltip object via calling create()method.
 BOOL bRet = m_Tips.Create(CSize(200, 20));    
 return bRet ? 0 : -1;

step 3 : Show tooltip in any time, any place

CColrView::OnMouseMove(UINT nFlags, CPoint point) 
 // TODO: Add your message handler code here and/or call default
 CPoint ptLog = point;
 CString strTemp;
 strTemp.Format("Mouse Pos: X = %d Y = %d ", point.x, point.y);
 // show tool tip in mouse move
 m_Tips.ShowTips(ptLog.x + 5, ptLog.y + 25, strTemp);
 CView::OnMouseMove(nFlags, point);
//  end

Note: Hide tooltip you call HideTips(), the method can hide Tips window.

Points of Interest

while I writting the code , C_tooltipctrl is not useful in my project. so wrote it just for my project . but it can using easily in any MFC project.


update source code 2007 09 18


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

WeiHua zhang
China China
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionShow tooltip at any place Pin
nguyen duc huan3-Jan-13 15:37
membernguyen duc huan3-Jan-13 15:37 
GeneralSome suggestions Pin
Hans Dietrich19-Sep-07 5:41
mvpHans Dietrich19-Sep-07 5:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170813.1 | Last Updated 18 Sep 2007
Article Copyright 2007 by WeiHua zhang
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid