Align Anchor Panel BackgroundImage

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?cmF5IG4=?=

    Align Anchor Panel BackgroundImage

    I have a need to put an image on the background of a SplitterPanel. However,
    I need it to appear in the bottom right corner of the panel instead of the
    standard Centered/Tiled/Stretched found in the BackgroundImage Layout Property.

    Is there an example of how to do that or could someone offer a suggestion?

    Thanks
  • Dave Sexton

    #2
    Re: Align Anchor Panel BackgroundImage

    Hi,

    You could try painting it yourself. Add an event handler for the splitter's
    Paint event, grab its Graphics object from the EventArgs argument (e) and
    use the DrawImage method.

    --
    Dave Sexton

    http://www.codeplex.com/DocProject (Sandcastle in Visual Studio 2005)

    "ray n" <ray n@discussions.m icrosoft.comwrote in message
    news:ADDE7667-7B0E-4BA1-AA29-DFF04764BC44@mi crosoft.com...
    >I have a need to put an image on the background of a SplitterPanel.
    >However,
    I need it to appear in the bottom right corner of the panel instead of the
    standard Centered/Tiled/Stretched found in the BackgroundImage Layout
    Property.
    >
    Is there an example of how to do that or could someone offer a suggestion?
    >
    Thanks

    Comment

    • =?Utf-8?B?cmF5IG4=?=

      #3
      Re: Align Anchor Panel BackgroundImage

      Hi Dave,

      Thanks for the response. I was able to draw the image where I wanted as you
      specified. However, the crucial part is having it set as the backgroundimage
      property.

      The reason for this madness is b/c there is a third party tool I'm using
      that has a transparency property. However, the only thing it is transparent
      to is its container's backcolor, or backgroundimage .

      Is there a way to override the PaintBackground Image event (if such one
      exists) and insert my paint code that way?



      "Dave Sexton" wrote:
      Hi,
      >
      You could try painting it yourself. Add an event handler for the splitter's
      Paint event, grab its Graphics object from the EventArgs argument (e) and
      use the DrawImage method.
      >
      --
      Dave Sexton

      http://www.codeplex.com/DocProject (Sandcastle in Visual Studio 2005)
      >
      "ray n" <ray n@discussions.m icrosoft.comwrote in message
      news:ADDE7667-7B0E-4BA1-AA29-DFF04764BC44@mi crosoft.com...
      I have a need to put an image on the background of a SplitterPanel.
      However,
      I need it to appear in the bottom right corner of the panel instead of the
      standard Centered/Tiled/Stretched found in the BackgroundImage Layout
      Property.

      Is there an example of how to do that or could someone offer a suggestion?

      Thanks
      >
      >
      >

      Comment

      • Dave Sexton

        #4
        Re: Align Anchor Panel BackgroundImage

        Hi,

        There's no override for painting only the background image, but there is a
        protected OnPaintBackgrou nd method that you could try, although you'd have
        to derive a control from SplitterPanel (if it's not sealed) and make sure
        that it's not painting everything in Paint (i.e., make sure the
        OnPaintBackgrou nd method is actually being invoked).

        The behavior you mention is normal for WinForms on Windows XP, which just
        emulates transparency on Controls (poorly). You may or may not be happy to
        know that true transparency in WinForms seems to work just fine on Vista :)

        --
        Dave Sexton

        http://www.codeplex.com/DocProject (Sandcastle in Visual Studio 2005)

        "ray n" <rayn@discussio ns.microsoft.co mwrote in message
        news:64A79B21-42A8-4613-8836-892CE32779FB@mi crosoft.com...
        Hi Dave,
        >
        Thanks for the response. I was able to draw the image where I wanted as
        you
        specified. However, the crucial part is having it set as the
        backgroundimage
        property.
        >
        The reason for this madness is b/c there is a third party tool I'm using
        that has a transparency property. However, the only thing it is
        transparent
        to is its container's backcolor, or backgroundimage .
        >
        Is there a way to override the PaintBackground Image event (if such one
        exists) and insert my paint code that way?
        >
        >
        >
        "Dave Sexton" wrote:
        >
        >Hi,
        >>
        >You could try painting it yourself. Add an event handler for the
        >splitter's
        >Paint event, grab its Graphics object from the EventArgs argument (e) and
        >use the DrawImage method.
        >>
        >--
        >Dave Sexton
        >http://davesexton.com/blog
        >http://www.codeplex.com/DocProject (Sandcastle in Visual Studio 2005)
        >>
        >"ray n" <ray n@discussions.m icrosoft.comwrote in message
        >news:ADDE766 7-7B0E-4BA1-AA29-DFF04764BC44@mi crosoft.com...
        >I have a need to put an image on the background of a SplitterPanel.
        >However,
        I need it to appear in the bottom right corner of the panel instead of
        the
        standard Centered/Tiled/Stretched found in the BackgroundImage Layout
        Property.
        >
        Is there an example of how to do that or could someone offer a
        suggestion?
        >
        Thanks
        >>
        >>
        >>

        Comment

        • =?Utf-8?B?cmF5IG4=?=

          #5
          Re: Align Anchor Panel BackgroundImage

          Ok, that helped me get it.

          I just extended the third party control and did an override on the
          OnPaintBackgrou nd method.

          After calling the base.OnPaintBac kground, I was able to place my image on
          the control.

          ..NET makes things like this easy to do.

          It's just the process of figuring out HOW to do it that's hard.

          Thanks for you help! :)

          Comment

          Working...