?
Solved

open image in paintbrush

Posted on 2001-08-09
3
Medium Priority
?
309 Views
Last Modified: 2008-03-10
how can i open a picture or image file in paintbrush when i double click on vb picturebox image and after editing return to vb form on which i click on picture box.
0
Comment
Question by:Vivek Agarwal
3 Comments
 
LVL 12

Accepted Solution

by:
Preece earned 200 total points
ID: 6370449

From MSDN on the PictureBox.Picture property:

When setting the Picture property at design time, the graphic is saved and loaded with the form. If you create an executable file, the file contains the image. When you load a graphic at run time, the graphic isn't saved with the application. Use the SavePicture statement to save a graphic from a form or picture box into a file.

Note   At run time, the Picture property can be set to any other object's DragIcon, Icon, Image, or Picture property, or you can assign it the graphic returned by the LoadPicture function.



I monkeyed around with this:

Private Sub Picture1_Click()
    Dim lRet As Integer
    lRet = Shell("mspaint.exe " & sPathandfilename)
End Sub

This call will work if you have the location of the file in a variable, sPathandfilename for instance.  

0
 

Expert Comment

by:devendra_patil
ID: 6371849
Try this code.
Private Sub Picture1_Click()
Dim strPath as String
strPath = App.Path & "\temp.bmp"
SavePicture Picture1.Picture, strPath 'or Picture1.Image
Shell "MsPaint.Exe" & GetShortPathName(strPath) 'Req if ur path contains spaces
End Sub

0
 
LVL 2

Expert Comment

by:JanusFury
ID: 6378384
Or...
Private Sub Picture1_Click()
Dim strPath as String
strPath = App.Path & "\temp.bmp"
SavePicture Picture1.Picture, strPath 'or Picture1.Image
Shell "Pbrush.Exe """ & strPath & """" ' Always works.
End Sub
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question