Results 1 to 6 of 6

Thread: Print picture from file

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2008
    Posts
    78

    Print picture from file

    Hi, i have a form with ten buttons on it.
    what i want to do is, when i click Button1, it will print Picture1.jpg from a file, and when i click Button2, it should print Picture2.jpg from a file.
    Also, i dont want the user to have to wait between the button clicking(for buffering).

    Thanks for your help!

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

    Re: Print picture from file

    You could print it yourself in code or you could use Process.Start to have the file printed externally by the default application. The second option is equivalent to right-clicking the file in Windows Explorer and selecting Print. Note that you don't get to choose the app though. Do you have a preference?
    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
    Lively Member
    Join Date
    Dec 2008
    Posts
    78

    Re: Print picture from file

    How would it work if i print it in code?
    I don't want any dialog box to appear. i just want it to print.
    thanks!

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

    Re: Print picture from file

    Quote Originally Posted by vbginner View Post
    How would it work if i print it in code?
    I don't want any dialog box to appear. i just want it to print.
    thanks!
    You would create a PrintDocument, call its print method, handle its PrintPage event and then call e.Graphics.DrawImage in the event handler. Merrion has posted a beginners guide to printing in the VB.NET CodeBank forum, so you might like to check that out for some guidance.
    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

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Dec 2008
    Posts
    78

    Re: Print picture from file

    Hi thanks for the help, but i'm a newbie, so i don't quite understand what your'e saying. Can you please give me an example in code to make things easier?
    thanks alot!

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

    Re: Print picture from file

    No, I'm not going to provide an example when I've already directed you to where you can find the information you need.
    Merrion has posted a beginners guide to printing in the VB.NET CodeBank forum, so you might like to check that out for some guidance.
    Have you gone to the VB.NET CodeBank forum and looked for it? There's a link to that forum at the top of the VB.NET forum home page or you can use the list of all forums on the site home page. Finding that information has nothing to do with programming so being a newbie is not a problem. If you can use the web, you can find that printing guide.
    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