transparency Q

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Williams

    transparency Q

    I used the example on Bob Powell's site to draw a gradient on the background
    of the parent form in my survey app. Now, I would like to have a logo
    docked in the corner, but have the background of the logo be the gradient,
    not the base color of the window. The logo is a gif set with a transparent
    color. Any suggestions?


  • Herfried K. Wagner [MVP]

    #2
    Re: transparency Q

    "Martin Williams" <wildstar@nospa m.net> schrieb;[color=blue]
    > Now, I would like to have a logo
    > docked in the corner, but have the background of the logo be the gradient,
    > not the base color of the window. The logo is a gif set with a
    > transparent
    > color.[/color]

    Instead of putting a pixturebox onto the form, use the 'Graphics' object's
    'DrawImage' method to draw the image on top of the gradient (similar to
    drawing the gradient). You can use 'Image.FromFile ' to load an image from
    disk, .NET will draw the image transparently automatically.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

    Comment

    • Martin Williams

      #3
      Re: transparency Q

      thanks, that did it. But, I have another Q...

      On the last form of the survey, there are some textboxes. When the form is
      activated, I set the focus to the "Finish" button to avoid seeing the
      insertion point in the textbox right away. However, when I tab through the
      controls, that first press of the tab button causes a momentary flicker on
      the screen, then it goes away. Any idea on what causes that?


      "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
      news:%23EnPTCmB FHA.3820@TK2MSF TNGP11.phx.gbl. ..[color=blue]
      > "Martin Williams" <wildstar@nospa m.net> schrieb;[color=green]
      > > Now, I would like to have a logo
      > > docked in the corner, but have the background of the logo be the[/color][/color]
      gradient,[color=blue][color=green]
      > > not the base color of the window. The logo is a gif set with a
      > > transparent
      > > color.[/color]
      >
      > Instead of putting a pixturebox onto the form, use the 'Graphics' object's
      > 'DrawImage' method to draw the image on top of the gradient (similar to
      > drawing the gradient). You can use 'Image.FromFile ' to load an image from
      > disk, .NET will draw the image transparently automatically.
      >
      > --
      > M S Herfried K. Wagner
      > M V P <URL:http://dotnet.mvps.org/>
      > V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
      >[/color]


      Comment

      • Martin Williams

        #4
        Re: transparency Q

        One more question - is there a way I can get the logo that was drawn with
        DrawImage to be in a relative position?

        "Martin Williams" <wildstar@nospa m.net> wrote in message
        news:COCdnQI1_5 5G0WHcRVn-gw@comcast.com. ..[color=blue]
        > thanks, that did it. But, I have another Q...
        >
        > On the last form of the survey, there are some textboxes. When the form[/color]
        is[color=blue]
        > activated, I set the focus to the "Finish" button to avoid seeing the
        > insertion point in the textbox right away. However, when I tab through[/color]
        the[color=blue]
        > controls, that first press of the tab button causes a momentary flicker on
        > the screen, then it goes away. Any idea on what causes that?
        >
        >
        > "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
        > news:%23EnPTCmB FHA.3820@TK2MSF TNGP11.phx.gbl. ..[color=green]
        > > "Martin Williams" <wildstar@nospa m.net> schrieb;[color=darkred]
        > > > Now, I would like to have a logo
        > > > docked in the corner, but have the background of the logo be the[/color][/color]
        > gradient,[color=green][color=darkred]
        > > > not the base color of the window. The logo is a gif set with a
        > > > transparent
        > > > color.[/color]
        > >
        > > Instead of putting a pixturebox onto the form, use the 'Graphics'[/color][/color]
        object's[color=blue][color=green]
        > > 'DrawImage' method to draw the image on top of the gradient (similar to
        > > drawing the gradient). You can use 'Image.FromFile ' to load an image[/color][/color]
        from[color=blue][color=green]
        > > disk, .NET will draw the image transparently automatically.
        > >
        > > --
        > > M S Herfried K. Wagner
        > > M V P <URL:http://dotnet.mvps.org/>
        > > V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
        > >[/color]
        >
        >[/color]


        Comment

        • Herfried K. Wagner [MVP]

          #5
          Re: transparency Q

          "Martin Williams" <wildstar@nospa m.net> schrieb:[color=blue]
          > One more question - is there a way I can get the logo that was drawn with
          > DrawImage to be in a relative position?[/color]

          You will have to listen for the window's 'Resize' or 'SizeChanged' event and
          call the form's/control's 'Invalidate' method there in order to repaint the
          background.

          --
          M S Herfried K. Wagner
          M V P <URL:http://dotnet.mvps.org/>
          V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

          Comment

          • Martin Williams

            #6
            Re: transparency Q

            Thanks again!

            "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
            news:%23hp8%23J sBFHA.2104@TK2M SFTNGP14.phx.gb l...[color=blue]
            > "Martin Williams" <wildstar@nospa m.net> schrieb:[color=green]
            > > One more question - is there a way I can get the logo that was drawn[/color][/color]
            with[color=blue][color=green]
            > > DrawImage to be in a relative position?[/color]
            >
            > You will have to listen for the window's 'Resize' or 'SizeChanged' event[/color]
            and[color=blue]
            > call the form's/control's 'Invalidate' method there in order to repaint[/color]
            the[color=blue]
            > background.
            >
            > --
            > M S Herfried K. Wagner
            > M V P <URL:http://dotnet.mvps.org/>
            > V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
            >[/color]


            Comment

            Working...