Results 1 to 4 of 4

Thread: Background images

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2010
    Posts
    5

    Exclamation Background images

    Hey guys I'm making a program and in which the user can select a background image from their computer, but I have not found a way to save the picture to my.settings or my.resources

    please help

  2. #2
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: Background images

    Well, My.Resources is ReadOnly, so it makes sense that you can't save the image to it.

    I'm not sure you can use My.Settings for the BackgroundImage. I couldn't find a property for it in ApplicationSettings. Since My.Settings doesn't save files, that's probably why it can't do it.

    Your only option would be to store the location of the background image somewhere.

    My suggestion, would be to either use and external file, like an XML file, to store the location of the chosen background image. Alternatively, you can also use a registry key, which might be quicker and easier.
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  3. #3
    Frenzied Member Pc_Not_Mac's Avatar
    Join Date
    Oct 2009
    Location
    localhost
    Posts
    1,206

    Re: Background images

    I came across a very good example of a background image changer on planet source code about a 5 months ago. I think this is the same one. example
    Good Luck
    My Codebank:
    Windows Vista & 7 Glass Effect & Limit the amount of times your application could be opened.
    Pause Your Code & Check the OS name

    The question of whether computers can think is like the question of whether submarines can swim.

    Currently learning: Java

    Coding can be a learning experience or

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

    Re: Background images

    If you did want to save an Image to My.Settings then you would do so as a base-64 encoded string. The Convert class has ToBase64String and FromBase64String methods to convert between String and Byte array. The String can be saved and loaded in My.Settings like any other String. To convert between an Image and a Byte array and vice versa, follow the CodeBank link in my signature and check out my thread on Saving Images In Databases.

    Note that the Framework already uses basically this same mechanism to store images in RESX files.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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