views:

138

answers:

3

Hello. I know it is possible to add a tooltip to just about every element in Visual Studio, but I was wondering if anyone knew if it was possible to add screentips to a label? I have 5 images I'd like to trigger when the user hovers their mouse above the element (a label).

I have 5 labels: Form, Crown, Trunk, Root Flare, and Roots and 5 pictures.

I know there is a MouseHover event but I cant seem to make it trigger the picture I want when it hovers.

Again, any help is greatly appreciated and I thank the community for all their support.

Note: I'm a very limited beginner and I'm doing the code in VB.

A: 

You can create a form in html with an image in it and refer to it on the tool tip by using its id in javascript. Check out this site.

Eric
I'm working in Visual Studio with VB and on a desktop that probably wont have web access. Is their any way for you or anyone else to translate what you just said into vb code?
A: 

You can use the MouseHover event of the label to create a new PictureBox with your image. You would then set the PictureBox's Location to your mouse coordinates or the location of the label. Then on the MouseLeave event of the label you would dispose of the PictureBox you created, if there is one.

This is C#, but something like this would work.

PictureBox hoverImage;
lblLabel_MouseHover()
{
hoverImage = new PictureBox;
MyImage = New Bitmap("C:\image.bmp");
hoverImage.Image = CType(MyImage, Image)
hoverImage.Location = lblLabel.Location;
}

lblLabel_MouseLeave()
{
hoverImage.Dispose();
}
Totty
Thanks! Now to get this translated into VB then I'll be cooking.
I tried to convert it to VB but failed.
A: 

What version of VB are you using? In vb.net 2008, you can add a tooltip control to the form, then add tooltip text as a property to a label (and other controls), all at design time. No coding is necessary.

xpda
I'm using VB.Net 2008. I know that I can add tooltips just about anytime, anywhere, but what I wanted to add was screentips--the tooltips that consist of images. Unless I can put images as tooltips...