By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,833 Members | 2,074 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,833 IT Pros & Developers. It's quick & easy.

Align Anchor Panel BackgroundImage

P: n/a
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 BackgroundImageLayout Property.

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

Thanks
Feb 6 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.microsoft.comwrote in message
news:AD**********************************@microsof t.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 BackgroundImageLayout
Property.

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

Thanks

Feb 6 '07 #2

P: n/a
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 PaintBackgroundImage 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.microsoft.comwrote in message
news:AD**********************************@microsof t.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 BackgroundImageLayout
Property.

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

Thanks


Feb 7 '07 #3

P: n/a
Hi,

There's no override for painting only the background image, but there is a
protected OnPaintBackground 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
OnPaintBackground 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://davesexton.com/blog
http://www.codeplex.com/DocProject (Sandcastle in Visual Studio 2005)

"ray n" <ra**@discussions.microsoft.comwrote in message
news:64**********************************@microsof t.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 PaintBackgroundImage 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.microsoft.comwrote in message
news:AD**********************************@microso ft.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 BackgroundImageLayout
Property.

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

Thanks



Feb 7 '07 #4

P: n/a
Ok, that helped me get it.

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

After calling the base.OnPaintBackground, 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! :)
Feb 7 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.