1 Replies - 4691 Views - Last Post: 14 July 2010 - 08:44 AM Rate Topic: -----

#1 JoshD  Icon User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 111
  • Joined: 22-March 10

Dynamically Adding Background Image

Posted 14 July 2010 - 06:17 AM

Basically, the title says the most of it.

I'm dynamically creating a button control, and I'd like to add a background image from my resources thing to the button.
Now, I'm pretty sure it would be:
variable.BackgroundImage =

but I don't know how to refer to an image that is in my project resources.

I've tried:
 = Image.FromFile(My.Resources.myimage)
but that gives error:Value of type 'System.Drawing.Bitmap' cannot be converted to 'String'.

Thanks.
Josh.

EDIT: NEVERMIND, it was "my.resources.myimage" instead of "image.fromfile(my.resources.myimage)"
Thanks anyway!
Josh.

This post has been edited by JoshD: 14 July 2010 - 06:28 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Dynamically Adding Background Image

#2 motcom  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 290
  • View blog
  • Posts: 1,371
  • Joined: 16-June 08

Re: Dynamically Adding Background Image

Posted 14 July 2010 - 08:44 AM

Yeah, most probably "My.Resources.myimage" was already of type "Image"... :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1