65.9K
CodeProject is changing. Read more.
Home

A nice multiline ToolTipCtrl example.

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.42/5 (20 votes)

Feb 9, 2004

viewsIcon

127474

downloadIcon

3930

A nice multiline ToolTipCtrl example looking like the one available in Delphi.

Sample Image - ToolTipEx.jpg

Introduction

Well there is nothing much to say about this. This is a simple better looking multi-line tooltip control.

#pragma once
class CToolTipCtrlEx : public CToolTipCtrl
{
 DECLARE_DYNAMIC(CToolTipCtrlEx)
 enum Orientations
 {
  NW=1,
  NE,
  SW,
  SE,
 };
public:
 CToolTipCtrlEx();
 virtual ~CToolTipCtrlEx();
protected:
 DECLARE_MESSAGE_MAP()
 virtual void PreSubclassWindow();
private:
 afx_msg void OnPaint();
 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
 afx_msg void OnNcPaint();
public:
 COLORREF m_bkColor;//=RGB(255,255,255);
 COLORREF m_leftColor;//=RGB(255, 210, 83);
 COLORREF m_frameColor;//=RGB(155, 110, 53);
 COLORREF m_textColor;//=RGB(0,0,0);
 COLORREF m_arrowColor;//=RGB(0,0,0);
};

Just use it like a normal ToolTipCtrl control.

In the end

This is a tooltip inspired by the Delphi Flat Hint and the arrows are using the port of the Delphi drawing algorithm. This is free to use, modify it but you can't claim it. Any feedback and rating is most welcome.