Transparency

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marco Trapanese

    Transparency


    Hi!

    I need to create a user control with transparent background. Picturebox
    for example doesn't show any other control under it even if it has the
    background color set to transparent.

    Which control should I use?

    Thanks
    Marco / iw2nzm

  • Andrew Christiansen

    #2
    Re: Transparency

    You can set the SupportsTranspa rentBackgroundC olor bit in the constructor of
    your user control using MyBase.SetStyle . This will allow you to set the
    control's BackColor property to a color with an alpha value other than 255.

    - Andrew

    "Marco Trapanese" <marcotrapanese NOSPAM@libero.i twrote in message
    news:O0dci.3821 1$U01.410173@tw ister1.libero.i t...
    >
    Hi!
    >
    I need to create a user control with transparent background. Picturebox
    for example doesn't show any other control under it even if it has the
    background color set to transparent.
    >
    Which control should I use?
    >
    Thanks
    Marco / iw2nzm
    >

    Comment

    • Marco Trapanese

      #3
      Re: Transparency

      Andrew Christiansen wrote:
      You can set the SupportsTranspa rentBackgroundC olor bit in the
      constructor of your user control using MyBase.SetStyle . This will allow
      you to set the control's BackColor property to a color with an alpha
      value other than 255.

      Thanks for your answer. I already did it. But it doesn't works.
      The background will be transparent to the form but not to other controls
      behind it.

      Example:

      Place a button in the middle of the form. Place a picture box over it
      and set the background color of the picture box as transparent. It
      doesn't show the button.

      This is what I want! :)

      Bye
      Marco / iw2nzm

      Comment

      • rowe_newsgroups

        #4
        Re: Transparency

        On Jun 15, 2:19 am, Marco Trapanese <marcotrapanese NOS...@libero.i t>
        wrote:
        Andrew Christiansen wrote:
        You can set the SupportsTranspa rentBackgroundC olor bit in the
        constructor of your user control using MyBase.SetStyle . This will allow
        you to set the control's BackColor property to a color with an alpha
        value other than 255.
        >
        Thanks for your answer. I already did it. But it doesn't works.
        The background will be transparent to the form but not to other controls
        behind it.
        >
        Example:
        >
        Place a button in the middle of the form. Place a picture box over it
        and set the background color of the picture box as transparent. It
        doesn't show the button.
        >
        This is what I want! :)
        >
        Bye
        Marco / iw2nzm
        AFAIK, there is not a way to do this with a control. What exact are
        you trying to accomplish - perhaps we know of a better way? Also, GDI+
        supports alpha drawing, so you might look into using it to drawing
        directly onto the form instead of just placing a control.

        Thanks,

        Seth Rowe

        Comment

        • Marco Trapanese

          #5
          Re: Transparency

          rowe_newsgroups wrote:
          AFAIK, there is not a way to do this with a control.
          urgh :(
          What exact are
          you trying to accomplish - perhaps we know of a better way? Also, GDI+
          supports alpha drawing, so you might look into using it to drawing
          directly onto the form instead of just placing a control.
          Ok! I use GDI+ but I'd like to do something like this (I hope I can
          explain it with my poor English!)

          I created a progress bar with an 'angle' property which draws the bar in
          any direction. However, the container of the control is a box. I need to
          put several progress bars over each other. I might draw each bar
          directly on the form but it would be nice if I can use them separately
          as user control.

          The transparency is required because the unused space around the bar
          must shows other controls behind it.

          Comment

          • Chris Dunaway

            #6
            Re: Transparency

            On Jun 15, 5:59 am, Marco Trapanese <marcotrapanese NOS...@libero.i t>
            wrote:
            rowe_newsgroups wrote:
            AFAIK, there is not a way to do this with a control.
            >
            urgh :(
            >
            What exact are
            you trying to accomplish - perhaps we know of a better way? Also, GDI+
            supports alpha drawing, so you might look into using it to drawing
            directly onto the form instead of just placing a control.
            >
            Ok! I use GDI+ but I'd like to do something like this (I hope I can
            explain it with my poor English!)
            >
            I created a progress bar with an 'angle' property which draws the bar in
            any direction. However, the container of the control is a box. I need to
            put several progress bars over each other. I might draw each bar
            directly on the form but it would be nice if I can use them separately
            as user control.
            >
            The transparency is required because the unused space around the bar
            must shows other controls behind it.
            Instead of using a box as the container of your control, set the
            controls Region property to the exact shape that you need.

            Have you considered using WPF? With WPF its almost trivial to display
            any control at an angle.

            Chris

            Comment

            Working...