473,320 Members | 1,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

form's backgroundimage

hey all,

how do i change the BackgroundImage property of my form in code?

thanks,
rodchar
Jul 24 '06 #1
7 3779
Check MSDN help.
Its well documented.

rodchar wrote:
hey all,

how do i change the BackgroundImage property of my form in code?

thanks,
rodchar
Jul 24 '06 #2
"rodchar" <ro*****@discussions.microsoft.comschrieb:
how do i change the BackgroundImage property of my form in code?
\\\
Me.BackgroundImage = ...
///

You can use 'Image.FromFile' to load a bitmap file, for example.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Jul 24 '06 #3
ok i took Steven's advice and found the same thing your showing:

Me.BackgroundImage = Image.FromFile("Untitled1.png")

i noticed however when i compile i just have a single executable which i
guess contains the current image. is there a way to keep it a single
executable when i want to add a 2nd image and switch between the two images
via mouse wheel event?

"Herfried K. Wagner [MVP]" wrote:
"rodchar" <ro*****@discussions.microsoft.comschrieb:
how do i change the BackgroundImage property of my form in code?

\\\
Me.BackgroundImage = ...
///

You can use 'Image.FromFile' to load a bitmap file, for example.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Jul 24 '06 #4
also, i noticed it overlapped my first image. do i need to clear the
background first and then replace with my 2nd image?

"rodchar" wrote:
ok i took Steven's advice and found the same thing your showing:

Me.BackgroundImage = Image.FromFile("Untitled1.png")

i noticed however when i compile i just have a single executable which i
guess contains the current image. is there a way to keep it a single
executable when i want to add a 2nd image and switch between the two images
via mouse wheel event?

"Herfried K. Wagner [MVP]" wrote:
"rodchar" <ro*****@discussions.microsoft.comschrieb:
how do i change the BackgroundImage property of my form in code?
\\\
Me.BackgroundImage = ...
///

You can use 'Image.FromFile' to load a bitmap file, for example.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Jul 24 '06 #5
I apologize for the confusion, let me rethink what i'm trying to do and
repost after i have a clearer understanding.

"rodchar" wrote:
also, i noticed it overlapped my first image. do i need to clear the
background first and then replace with my 2nd image?

"rodchar" wrote:
ok i took Steven's advice and found the same thing your showing:

Me.BackgroundImage = Image.FromFile("Untitled1.png")

i noticed however when i compile i just have a single executable which i
guess contains the current image. is there a way to keep it a single
executable when i want to add a 2nd image and switch between the two images
via mouse wheel event?

"Herfried K. Wagner [MVP]" wrote:
"rodchar" <ro*****@discussions.microsoft.comschrieb:
how do i change the BackgroundImage property of my form in code?
>
\\\
Me.BackgroundImage = ...
///
>
You can use 'Image.FromFile' to load a bitmap file, for example.
>
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
>
Jul 24 '06 #6
That would be a good idea.

If you want to be drawing multiple images all the time, a background
image or picturebox might not be the best option. There is an entire
namespace (System.Drawing) dedicated to drawing to surfaces. Generally,
most controls / forms have an OnPaint event where you can customise
what gets painted (drawn) to that surface

Also when changing images the way you are, its good to invalidate the
control/form.
Refresh is also an option, although may cause flicker.

Further topics found in MSDN if you search for GDI or GDI+.
Should be some walkthroughs for the OnPaint stuff.

rodchar wrote:
I apologize for the confusion, let me rethink what i'm trying to do and
repost after i have a clearer understanding.
Jul 24 '06 #7
thanks everyone for the help.

"Steven Nagy" wrote:
That would be a good idea.

If you want to be drawing multiple images all the time, a background
image or picturebox might not be the best option. There is an entire
namespace (System.Drawing) dedicated to drawing to surfaces. Generally,
most controls / forms have an OnPaint event where you can customise
what gets painted (drawn) to that surface

Also when changing images the way you are, its good to invalidate the
control/form.
Refresh is also an option, although may cause flicker.

Further topics found in MSDN if you search for GDI or GDI+.
Should be some walkthroughs for the OnPaint stuff.

rodchar wrote:
I apologize for the confusion, let me rethink what i'm trying to do and
repost after i have a clearer understanding.

Jul 25 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ken Lee | last post by:
Hi all, I'm sort of very new to C# and haven't programmed in OO for a while. I'm trying to override the backgroundimage to the tabcontrol but it just doesn't seem to want to do it, can someone...
2
by: Alex Gray | last post by:
Hi, I'm trying to make my PictureBox transparent to the BackgroundImage of the Form, not the BackColor of the form. Here's what i have: ---------------------------------------------------...
1
by: kjon | last post by:
Hi, I'm trying to get the BackgroundImage of a form/control and draw it again in runtime. But if the Backgroundimage is "None", the DrawImage command will give an error. Is it possible to...
39
by: jcrouse | last post by:
I am using the following code to get a background image for my form Private Sub mnuBgroundImage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuBgroundImage.Clic If...
1
by: John | last post by:
Hello all, I was wondering, does this property really exist in VB.NET 2003? Because it's listed in Intellisense, but setting it doesn't seem to have the slightest effect on the visual look of...
40
by: Geoff Jones | last post by:
Hi Can anybody help me with the following? It is driving me crazy!!! I'm trying to produce a non-rectangular form as follows: (1) Produce a bitmap e.g. gif, using paint shop pro 5. (2) The...
12
by: Sharon | last post by:
I’m using a Panel control in my form to display a background image. So in the Form OnPaint() I wrote: myPanel.BackgroundImage = m_bmp; While the m_bmp is the Form Bitmap member. The problem...
1
by: moi.romanowsky | last post by:
Does anyone know why the backgroundImage does not display in VB? I have tried setting it in the properties window (where the thumbnail shows) and explicitly in my code like so: ...
2
by: bradyounie | last post by:
I'm trying to use a Form's BackgroundImage to display the base image that I'm placing controls on top of. To make the form scroll to the bounds of the image, I set the AutoScrollMinSize. This works...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.