65.9K
CodeProject is changing. Read more.
Home

XP Link Label (VB 2005)

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.64/5 (20 votes)

Dec 4, 2005

CPOL

1 min read

viewsIcon

62025

downloadIcon

256

A LinkLabel that mimics the ones in the task pane of Windows Explorer.

Introduction

This is my first attempt at making my own control. It mimics the LinkLabel that XP uses in the task pane on the left hand side of Explorer windows.

Screenshot of the real LinkLabels:

Sample image

The screenshot below shows the control at design time. As you can see, it has a "Smart Tag" with it, and the code also shows how to remove properties from the Properties panel that you don't want users to change.

Sample image

I know that you can probably just take a normal LinkLabel and add an image to it to make it look kind of like this, but I wanted to figure out how to add my own Smart Tags and display the real hand cursor when you hovered over it. The hand cursor that displays on this control is not the one that is built into VS. It's the real one from XP, with the shadow under it.

Take a look at it if you want and, by all means, leave me comments. I wasn't really sure how to do the drawing of the image and text, I was just winging it, so I'm sure there are better ways of doing it.

Update

I noticed that the mouse cursor was flickering when it left the control, and figured out that it was the following line:

SetCursor(0)

If you have downloaded the demo, remove the above line for a smoother MouseLeave.