|
-
Oct 29th, 2003, 04:17 PM
#1
Thread Starter
New Member
VB.net users Unite!!
Hello I'm new and would like to introduce myself to everybody. The only reason I signed up is because of my lack of VB.net knowledge.
I got a couple of questions for people who wants to help.
Here's the set-up:
I changed the form background with an image
I want to be able to change the background image from another image by a click of a button. Is this possible? If so then what's the code for this. I'm quessing I have to change the assembly or something but what do I know.
I am using VB.net so
I know nothing that's why I need your help
-
Oct 29th, 2003, 04:25 PM
#2
Double click on the button, in the click even put
Code:
form1.ActiveForm.BackgroundImage.FromFile(FileNameOfImage)
-
Oct 29th, 2003, 04:25 PM
#3
are you after changing the image with another which is embedded? or an image from a location on the HD ?
if it's from an embedded resource....
VB Code:
[Color=Blue]Dim[/COLOR] path [Color=Blue]As[/COLOR] [Color=Blue]String[/COLOR] = Application.ProductName & ".DCP_0567.JPG"
[Color=Blue]MyBase[/COLOR].BackgroundImage = Image.FromStream([Color=Blue]MyBase[/COLOR].GetType.Assembly.GetManifestResourceStream(path))
if it's from a file ...
VB Code:
[color=blue]MyBase[/color].BackgroundImage = Image.FromFile(" path of image here ")
Last edited by dynamic_sysop; Oct 29th, 2003 at 04:30 PM.
~
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]
-
Oct 29th, 2003, 04:45 PM
#4
Lively Member
Another way is:
VB Code:
Dim bit As Bitmap = New Bitmap("c:\yourPicture.jpg")
Me.BackgroundImage = bit
-
Oct 30th, 2003, 10:40 AM
#5
Thread Starter
New Member
Umm. Like I said I'm a real newb at this
On the three codes that were given to me. Umm where should I input them. DO I put them in the button or the somewhere else.
I know nothing that's why I need your help
-
Oct 30th, 2003, 02:47 PM
#6
I wonder how many charact
Don't use
It doesn't close the file, so if you call upon it again, you will have problems (File resource being used elsewhere or file already open).
Its not a bug per se, it was supposed to be 'by design'.
Anyway, just use FromStream instead. That way you can explicitly close the image file when you are done loading it, and reuse it.
Last edited by nemaroller; Oct 30th, 2003 at 05:44 PM.
-
Nov 1st, 2003, 02:55 AM
#7
New Member
yes, neo, code them to the button's click event (assuming you want the image to change when the user clicks the button).
great sig, btw, sysop.
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
|