Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. How to copy a picture???

How to copy a picture???

Scheduled Pinned Locked Moved C#
designdebugginghelptutorialquestion
5 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CrazyDragon6384
    wrote on last edited by
    #1

    I want to design a program that operate in the following: click a button--> OpenFileDialog, chose the pic that u want to copy.... If DialogResult.OK --->the selected picture is copied to folder \bin\debug with the name "copied.gif" Help me, pleaseeeee

    W C C 3 Replies Last reply
    0
    • C CrazyDragon6384

      I want to design a program that operate in the following: click a button--> OpenFileDialog, chose the pic that u want to copy.... If DialogResult.OK --->the selected picture is copied to folder \bin\debug with the name "copied.gif" Help me, pleaseeeee

      W Offline
      W Offline
      Wjousts
      wrote on last edited by
      #2

      So what's your problem? A picture is a file just like any other so just use File.Copy. Or did you want to convert formats?

      1 Reply Last reply
      0
      • C CrazyDragon6384

        I want to design a program that operate in the following: click a button--> OpenFileDialog, chose the pic that u want to copy.... If DialogResult.OK --->the selected picture is copied to folder \bin\debug with the name "copied.gif" Help me, pleaseeeee

        C Offline
        C Offline
        CodyGen
        wrote on last edited by
        #3

        OpenFileDialog openFile = new OpenFileDialog(); openFile.Filter = "Image files|*.tif;*.tiff;*.bmp|All files (*.*)|*.*"; if (openFile.ShowDialog() == DialogResult.OK) { File.Copy(openFile.FileName, Application.StartupPath +"\\coped.gif"); } -- modified at 15:45 Friday 20th January, 2006

        1 Reply Last reply
        0
        • C CrazyDragon6384

          I want to design a program that operate in the following: click a button--> OpenFileDialog, chose the pic that u want to copy.... If DialogResult.OK --->the selected picture is copied to folder \bin\debug with the name "copied.gif" Help me, pleaseeeee

          C Offline
          C Offline
          CrazyDragon6384
          wrote on last edited by
          #4

          :) and... how to create a folder and save my file to that folder??? In OpenFileDialog, filter, how to display in the textbox "File of type" like: Image File (*.gif;*.jpg;*.bmp) thanks :)

          C 1 Reply Last reply
          0
          • C CrazyDragon6384

            :) and... how to create a folder and save my file to that folder??? In OpenFileDialog, filter, how to display in the textbox "File of type" like: Image File (*.gif;*.jpg;*.bmp) thanks :)

            C Offline
            C Offline
            CodyGen
            wrote on last edited by
            #5

            Before saving a file to a particular folder, it is a good practice that you check the folder's existence. Review the following code: string MyFolderDir = "C:\\MyFolder\\"; if(!Directory.Exists(MyFolderDir )) // if your folder does not exist { Directory.Create(MyFolderDir); // create the folder on the specified directory } In the "File of Type" dropdown, you just need to specify the text that would appear and the filter. You can separate them using the "|" character. Like this: openFile.Filter = "Image File (*.gif;*.jpg;*.bmp)|*.gif;*.jpg;*.bmp"; Microsoft KB and other sites such as this have very good articles about File operations. Try exploring. Enjoy! :-D -- modified at 9:45 Saturday 21st January, 2006

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups