Jump to content

How to Opens JPEG Diagram in Windows Image Viewer

- - - - -

  • Please log in to reply
8 replies to this topic

#1
DrDotNet

DrDotNet

    Newbie

  • Members
  • Pip
  • 4 posts
Hi, I want to build an application in which when someone Selects a Model No. of a Cell Phone, a JPEG Diagram Should be open in Windows Image Viewer instead of VB Picture Box because User want to Zoom, Rotate or save the JPEG File...
Can any body gimme a help how to do this ???
I am new in programing and not getting proper lessons from any where, just surfs the web for the relevant stuff.. so plz consider me

#2
danp129

danp129

    Newbie

  • Members
  • Pip
  • 3 posts
You can do this
process.start("c:\pathToApplication\Application.exe", "c:\pathToPicture\Picture.jpg")

But not everybody may have it installed, so you can do this instead to open the picture in the default program assigned to open files of that type
process.start("c:\pathToApplication\Application.exe", "c:\pathToPicture\Picture.jpg")


#3
Blimp

Blimp

    Programmer

  • Members
  • PipPipPipPip
  • 154 posts
This thread has been posted AND answered at least twice already. Try to refrain from double posting, as people will always try to help, double posting just clogs the forum.

As said by danp129, you need to use process.start

I'd go with the :
Process.Start("C:\yourimage.jpg")
Rather than danp129's example, as this means you can open it with the default application, rather than opening it with a program that might not be installed.

#4
danp129

danp129

    Newbie

  • Members
  • Pip
  • 3 posts
Oops, I meant to give the example of using the filename only in the second code block but accidentally copied the wrong line!

#5
DrDotNet

DrDotNet

    Newbie

  • Members
  • Pip
  • 4 posts
Great, its working.. Great, its working.. but I want to use existing Images from My.Resources, and its not working on it.. is there any other solution ?? It I think there is ......
Thankx 4 response

#6
danp129

danp129

    Newbie

  • Members
  • Pip
  • 3 posts
It would look something like this:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        SaveFileDialog1.ShowDialog()

    End Sub


    Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk

        My.Resources.MyImageName.Save(SaveFileDialog1.FileName, Drawing.Imaging.ImageFormat.Jpeg)

        Process.Start(SaveFileDialog1.FileName)

    End Sub



#7
Blimp

Blimp

    Programmer

  • Members
  • PipPipPipPip
  • 154 posts
I wouldn't notify the user that you're saving the image, rather save it to a temp folder.

Dim bmp as bitmap = My.Resources.IMAGE_NAME
dim dirandfile as string = My.Computer.Filesystem.SpecialDirectories.Temp("newimagename.bmp")
bmp.save(dirandfile)
Process.Start(dirandfile)

Edited by Blimp, 02 February 2012 - 09:41 AM.


#8
ahmadsofi

ahmadsofi

    Newbie

  • Members
  • Pip
  • 1 posts
saya kog malah bingung ya???? :cursing:

#9
Blimp

Blimp

    Programmer

  • Members
  • PipPipPipPip
  • 154 posts

ahmadsofi said:

saya kog malah bingung ya???? :cursing:

Something about being confused... If you have a question, post a new thread asking about it. We'll gladly help you out!

~ blimp.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users