Center Single Bitmap Background?

  • Thread starter Thread starter localhost
  • Start date Start date
L

localhost

I have a .bmp that I want to use as the form background and anchor it
to the bottom-right corner of the form.

I did this, but it tiles the image instead:


this.BackgroundImage = Image.FromFile( @".\MyImage.bmp" );


I only want to show a single image. How to do that?

Thanks.
 
Override the OnPaintBackground and explicitly draw the image stretched to
the form.

If you want to keep the aspect ratio of the image true see the GDI+ FAQ for
details on how to find the best-fit for an image.

--
Bob Powell [MVP]
Visual C#, System.Drawing

All you ever wanted to know about ListView custom drawing is in Well Formed.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*

The GDI+ FAQ: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://royo.is-a-geek.com/siteFeeder/GetFeed.aspx?FeedId=41

*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*
 
Back
Top