简体   繁体   中英

cxgrid custom menuitem (open with) for Image field

In cxGrid i have a column which is "Image" type.(properties=Image,GraphicClassName=TJpegImage). To the PopUpMenuLayout - MenuItems I have added a CustomMenuItem called "Open With...". How can I implement this custom menu item so that it opens my underlying image with Paint (windows Paint)? Or at least trigger the "Open with.." windows dialog.

If you have your image stored in a database then you will first have to save it into image file on your computer.

Then you can then simply use ShellExecute for opening this image with default image viewing/editing program. ShellExecute works basically the same as if user would have double-clicked on your file. The problem is that usually doublec-licking on image file opens a preview of it so if you need to edit that image using of ShellExecute might not be the best way.

Now in order to be sure that the image is opened for editing rathen than just in preview you would have to read windows registry to get information about which program is used for viewing and editing of that specific image format and then use CreateProcess API cal instead.

You could also make sure that image is opened with specific program by starting that program using CreateProcess API call and passing image location as startup parameter (most image editing programs treat first parameter as file to open upon startup

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM