Home All Groups Group Topic Archive Search About

Transparent attribute for labels

Author
25 Sep 2006 5:54 PM
MikeB
Hi, I created a picturebox with a map as an image. I want to make
certain areas on the map clickable hotspots and the way I'm trying to
do this is to create a transparent label with a different cursor (hand)
and then I code the click_event for that label. However, I cannot make
the label transparent, even if I choose the Transparent option for the
attribute for the background color of the label. Any ideas or
suggestions?

Thanks

Author
25 Sep 2006 6:41 PM
dotNetDave
Off the top of my head, I would not use controls like that because of the
overhead. I would look into graphic reagions and then during the mouse down
event change the cursor based on if the x y coordinate is within one of the
regions.
======================================
David McCarter
www.vsdntips.com
VSDN Tips & Tricks .NET Coding Standards available at:
www.cafepress.com/vsdntips.20412485


Show quoteHide quote
"MikeB" wrote:

> Hi, I created a picturebox with a map as an image. I want to make
> certain areas on the map clickable hotspots and the way I'm trying to
> do this is to create a transparent label with a different cursor (hand)
> and then I code the click_event for that label. However, I cannot make
> the label transparent, even if I choose the Transparent option for the
> attribute for the background color of the label. Any ideas or
> suggestions?
>
> Thanks
>
>
Author
25 Sep 2006 8:19 PM
MikeB
OK, I'm not the sharpest knife in the drawer, but are you telling me
that causing a continuous interrupt stream generated by Mousedown and
then the program work to map the x,y location to the region of a
hotspot is less work than the isolated event that occurs when the user
clicks on the hotspot?

The way I'm trying to do it seems to be a LOT less coding. All that I'm
having difficulty with is the Transparent attribute for BackColor.

Mike

dotNetDave wrote:
Show quoteHide quote
> Off the top of my head, I would not use controls like that because of the
> overhead. I would look into graphic reagions and then during the mouse down
> event change the cursor based on if the x y coordinate is within one of the
> regions.
> ======================================
> David McCarter
> www.vsdntips.com
> VSDN Tips & Tricks .NET Coding Standards available at:
> www.cafepress.com/vsdntips.20412485
>
>
> "MikeB" wrote:
>
> > Hi, I created a picturebox with a map as an image. I want to make
> > certain areas on the map clickable hotspots and the way I'm trying to
> > do this is to create a transparent label with a different cursor (hand)
> > and then I code the click_event for that label. However, I cannot make
> > the label transparent, even if I choose the Transparent option for the
> > attribute for the background color of the label. Any ideas or
> > suggestions?
> >
> > Thanks
> >
> >
Author
2 Oct 2006 7:01 PM
dotNetDave
Just a warning, I have seen the transparency of controls not work with some
video cards, that's why I use regions instead.

David


Show quoteHide quote
"MikeB" wrote:

> OK, I'm not the sharpest knife in the drawer, but are you telling me
> that causing a continuous interrupt stream generated by Mousedown and
> then the program work to map the x,y location to the region of a
> hotspot is less work than the isolated event that occurs when the user
> clicks on the hotspot?
>
> The way I'm trying to do it seems to be a LOT less coding. All that I'm
> having difficulty with is the Transparent attribute for BackColor.
>
> Mike
>
> dotNetDave wrote:
> > Off the top of my head, I would not use controls like that because of the
> > overhead. I would look into graphic reagions and then during the mouse down
> > event change the cursor based on if the x y coordinate is within one of the
> > regions.
> > ======================================
> > David McCarter
> > www.vsdntips.com
> > VSDN Tips & Tricks .NET Coding Standards available at:
> > www.cafepress.com/vsdntips.20412485
> >
> >
> > "MikeB" wrote:
> >
> > > Hi, I created a picturebox with a map as an image. I want to make
> > > certain areas on the map clickable hotspots and the way I'm trying to
> > > do this is to create a transparent label with a different cursor (hand)
> > > and then I code the click_event for that label. However, I cannot make
> > > the label transparent, even if I choose the Transparent option for the
> > > attribute for the background color of the label. Any ideas or
> > > suggestions?
> > >
> > > Thanks
> > >
> > >
>
>
Author
3 Oct 2006 3:03 AM
MikeB
This is driving me crazy. I could swear I had this to work and since
last night when I try it out in my project, it again fails!

If I have the image on the background of the form, I can create a
transparent label whee the cursor changes.

If I put the image in a picturebox and place the label over it, I get
the blank label overlaying the image. If I then in the load event for
the form code

label.parent = picturebox

Then the label box disappears from the screen and I can't mouse over
it, but I can see the image just fine. Ack! What am I overlooking that
made it stop working since last week?

I've tried Send to back and Bring to front, but that doesn't seem to
have any effect, both from the designer and program-wise.

I've got such an important part of my project hinging on this and I've
kinda misplaced the working sample I had last week, I'm in real
trouble.

dotNetDave wrote:
Show quoteHide quote
> Just a warning, I have seen the transparency of controls not work with some
> video cards, that's why I use regions instead.
>
> David
>
>
> "MikeB" wrote:
>
> > OK, I'm not the sharpest knife in the drawer, but are you telling me
> > that causing a continuous interrupt stream generated by Mousedown and
> > then the program work to map the x,y location to the region of a
> > hotspot is less work than the isolated event that occurs when the user
> > clicks on the hotspot?
> >
> > The way I'm trying to do it seems to be a LOT less coding. All that I'm
> > having difficulty with is the Transparent attribute for BackColor.
> >
> > Mike
> >
> > dotNetDave wrote:
> > > Off the top of my head, I would not use controls like that because of the
> > > overhead. I would look into graphic reagions and then during the mouse down
> > > event change the cursor based on if the x y coordinate is within one of the
> > > regions.
> > > ======================================
> > > David McCarter
> > > www.vsdntips.com
> > > VSDN Tips & Tricks .NET Coding Standards available at:
> > > www.cafepress.com/vsdntips.20412485
> > >
> > >
> > > "MikeB" wrote:
> > >
> > > > Hi, I created a picturebox with a map as an image. I want to make
> > > > certain areas on the map clickable hotspots and the way I'm trying to
> > > > do this is to create a transparent label with a different cursor (hand)
> > > > and then I code the click_event for that label. However, I cannot make
> > > > the label transparent, even if I choose the Transparent option for the
> > > > attribute for the background color of the label. Any ideas or
> > > > suggestions?
> > > >
> > > > Thanks
> > > >
> > > >
> >
> >
Author
25 Sep 2006 8:44 PM
Chris Dunaway
MikeB wrote:
> Hi, I created a picturebox with a map as an image. I want to make
> certain areas on the map clickable hotspots and the way I'm trying to
> do this is to create a transparent label with a different cursor (hand)
> and then I code the click_event for that label. However, I cannot make
> the label transparent, even if I choose the Transparent option for the
> attribute for the background color of the label. Any ideas or
> suggestions?
>
> Thanks

When you place the label on the PictureBox, the label parented to the
form.  If you set the label's parent to the PictureBox, then using a
backcolor of transparent will work.
Author
25 Sep 2006 10:00 PM
MikeB
Chris Dunaway wrote:
Show quoteHide quote
> MikeB wrote:
> > Hi, I created a picturebox with a map as an image. I want to make
> > certain areas on the map clickable hotspots and the way I'm trying to
> > do this is to create a transparent label with a different cursor (hand)
> > and then I code the click_event for that label. However, I cannot make
> > the label transparent, even if I choose the Transparent option for the
> > attribute for the background color of the label. Any ideas or
> > suggestions?
> >
> > Thanks
>
> When you place the label on the PictureBox, the label parented to the
> form.  If you set the label's parent to the PictureBox, then using a
> backcolor of transparent will work.

That must be my problem! Can you please tell me how I change or control
the parentage of the control?

Thanks so much
Mike
Author
26 Sep 2006 2:59 PM
Chris Dunaway
MikeB wrote:

> That must be my problem! Can you please tell me how I change or control
> the parentage of the control?

Just use a line like this:

label1.Parent = PictureBox1
Author
27 Sep 2006 6:26 PM
MikeB
Chris Dunaway wrote:
> MikeB wrote:
>
> > That must be my problem! Can you please tell me how I change or control
> > the parentage of the control?
>
> Just use a line like this:
>
> label1.Parent = PictureBox1

Thank you again. That was really helpful.

PS. I'm kinda new to the VB scene