Results 1 to 4 of 4

Thread: .NET 2003 Background Image on form

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    734

    Question .NET 2003 Background Image on form

    Hey guys,

    I wanted to have an image as the background of my form. My form will always be maximised.

    I have declared my image as a bitmap but when i say

    Me.BackgroundImage = imgBackground

    the image displays tiled and i want it to stretch to the full size of the form.
    I have tried to change the width, height and size of the image but it gives me an error saying that they are read only.

    Is there anyway i can get the image to fill the form?

    Thanks in advance for any help.
    If your problem has been solved then please mark the thread [RESOLVED].
    If i have helped then please Rate my post

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142

    Re: .NET 2003 Background Image on form

    Code:
    MyBase.BackgroundImageLayout = ImageLayout.Stretch
    put that in your form load or where you load the image.
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    734

    Re: .NET 2003 Background Image on form

    Hey, Thanks for the reply, but now i get an error message saying that 'BackgroundImageLayout' is not a member of 'System.Windows.Forms.Form'.

    Is there something else i need to include in my code before i can use this?
    If your problem has been solved then please mark the thread [RESOLVED].
    If i have helped then please Rate my post

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: .NET 2003 Background Image on form

    The BackgroundImageLayout property was new in .NET 2.0.

    You do need to change the size of your image but you cannot resize an existing Image object. You need to create a new Bitmap of the desired size, create a Graphics object for it and use that to draw the original Image onto the new one.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width