Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

A list control with hyperlink function

0.00/5 (No votes)
26 Feb 2008 1  
This control provides hyperlink function for the list control with exact positioning for the cursor.

Introduction

This code provides a way for adding hyperlink function for the CListCtrl.

Background

When I searched a method to do this, on The Code Project, I noticed that most of the available code provided the function, but not perfectly. When the cursor moves on the cell of the grid, the hyperlink works, but not the words. So, I decided to write code to provide the function in a better way.

Using the code

The basic class is CReportCtrl which is derived from CListCtrl.

The usage of CReportCtrl is quite simple, just like this:

m_list.SetColumnHeader(_T("no, 40, 1; name, 290, 1; link, 70, 1"));
m_list.SetGridLines(TRUE);
m_list.InsertItem( 0 , _T(""));
m_list.SetItemText(0, 0, 1);
m_list.SetItemText(0, 1, "website");
m_list.SetItemText(0, 2, "baidu");
m_list.SetItemURL(0, 2,"www.baidu.com","search website - www.baidu.com");
m_list.InsertItem(1, _T(""));
m_list.SetItemText(1, 0, 1);
m_list.SetItemText(1, 1, "gg");
m_list.SetItemText(1, 2, "google");
m_list.SetItemURL(1, 2,"www.google.com", "search website - www.google.com");

1.jpg

2.jpg

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here