-
Feb 10th, 2008, 02:15 PM
#1
Thread Starter
Fanatic Member
.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
-
Feb 10th, 2008, 02:24 PM
#2
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]
-
Feb 10th, 2008, 02:31 PM
#3
Thread Starter
Fanatic Member
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
-
Feb 10th, 2008, 08:11 PM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|