Results 1 to 4 of 4

Thread: setting a picture as a backround image

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2011
    Posts
    2

    setting a picture as a backround image

    Im using Visual studio 2005 and I want to push a button which opens either folderbrowserdialog or openfiledialog(which ever works better) and select a picture when I Push Ok the picture I selected becomes the backround image of the form does anybody have idea on how to do this? thanks

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

    Re: setting a picture as a backround image

    If you want to select a folder then you use a FolderBrowserDialog. If you want to select a file then you use an OpenFileDialog or SaveFileDialog, depending on whether the file is a source or a destination.

    Add your Button and OpenFileDialog to the form. Handle the Click event of the Button and, in the event handler, show the OpenFileDialog. If the user clicks OK, get the FileName from the dialogue and call Image.FromFile to create an Image object, which you can then assign to the appropriate form property.
    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2011
    Posts
    2

    Re: setting a picture as a backround image

    I dont understand is the call the image.fromfile but i get everything else, thanks for the reply

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

    Re: setting a picture as a backround image

    http://www.google.com.au/search?q=im...ient=firefox-a

    The first two results are the documentation, which should always be your first port of call anyway, plus there are more examples. That's you one freebie.
    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