Re: Transparent Container?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"Ken Halter" <Ken_Halter@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:OwU0ACKvGHA.4460@xxxxxxxxxxxxxxxxxxxxxxx

You [AppleBag] can't set the label backstyle = transparent?
How come? Text doesn't show?

It's because his Label is in a Frame control Ken, and he is making the Frame
transparent so that it shows the underlying Form image and he is effectively
punching "non transparent holes" into the Frame's transparent area in order
to display the controls it contains (including his Label). The problem with
that (for Labels) is when VB draws a transparent Label it draws the
container's background colour (or background image) first at that position
and then draws the Label caption on top of it using a FontTransparent of
True. This works fine when the transarent Label is on the Form of course (or
on some other non transparent container), but it doesn't work in this
specific case because VB uses the Frame's background before drawing the
Label's caption text (because the Frame is its cpntainer), and therefore his
Label (with BackStyle set to Transparent) will actually appear on the
otherwise transparent Frame as though the Label's background colour was the
same as the Frames colour and as though the Label was not transparent.
That's why I suggested he should simply fail to punch the "non transparent
rectangle" at the Label's position (so that the underlying Form image would
be visible at that point) and to draw the Label's Caption text directly onto
the Form, initially using the Print method for simplicity but later changing
it to use the DrawText API.

Mike Williams (MVP - Visual Basic)




.



Relevant Pages

  • Re: Transparent Container?
    ... The code works by setting up a clipping region that effectively make the entire Frame area transparent so that all you see is whatever happens to be underneath it. ... It then runs through the Form's Control Collection checking each control to see if its Container is the Frame, in which case it causes the small area occupied by that specific control to effectively be non-transparent, so that you can see the control. ... That works for all controls except transparent Labels, because the way VB draws those things causes the Label's transparency to cease to have an effect and you see the Label as though it was set to Opaque. ...
    (microsoft.public.vb.general.discussion)
  • Re: Transparent textbox
    ... > Running VB6 and want a text entry field that has a transparent ... and draw the resultant text directly onto the Form in a transparent manner. ... Box into which the user enters his data and a transparent Label Control to ... Private Sub Text1_Change ...
    (comp.lang.basic.visual.misc)
  • Re: Transparent Container?
    ... label, meaning the opaque background is still there, tooltip, etc. ... frame and do other design things to it, ... that specific control to effectively be non-transparent, ... That works for all controls except transparent Labels, ...
    (microsoft.public.vb.general.discussion)
  • Re: Transparent attribute for labels
    ... hotspot is less work than the isolated event that occurs when the user ... having difficulty with is the Transparent attribute for BackColor. ... event change the cursor based on if the x y coordinate is within one of the ... and then I code the click_event for that label. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Transparent Label
    ... How do you modify a controls parentage with the designer? ... When you set the backcolor of a control to transparent it will ... So if your label is over a picturebox and its ... the BackStyle property no longer exists and the ...
    (microsoft.public.dotnet.languages.vb)