Using Imaging Common Dialog (JavaScript)
1. |
Start with the project that you created in Loading and Displaying an Image. |
2. |
Add the following code to add the imaging common dialog COM object to your page: |
<OBJECT ID="LEADRasterDlg1" NAME="LEADRasterDlg1"
CLASSID="CLSID:00140B79-B1BA-11CE-ABC6-F5B2E79D9E3F"
CODEBASE="path to CAB file/Ltrdg14n.cab">
<P>This is not supported in the web browser.</P>
</OBJECT><BR>
3. |
Modify the LoadImage function as follows: |
var nRet;
var DLG_FO_AUTOPROCESS = 1;
var DLG_FO_PROGRESSIVE = 2;
var DLG_FO_MULTIPAGE = 4;
var DLG_FO_LOADROTATED = 8;
var DLG_FO_LOADCOMPRESSED = 16;
var DLG_FO_FILEINFO = 32;
var DLG_FO_SHOWPREVIEW = 64;
LEADRasterDlg1.FileDlgFlags = 0;
LEADRasterDlg1.DialogTitle = "Open a File";
LEADRasterDlg1.Filter = "All|*.*|CMP|*.cmp|JPEG|*.jpg";
LEADRasterDlg1.FilterIndex = 2; //look for .cmp first
LEADRasterDlg1.InitialDir = "s:\\temp\\images\\";
LEADRasterDlg1.LoadPasses = 0;
LEADRasterDlg1.LoadRotated = true;
LEADRasterDlg1.LoadCompressed = false;
LEADRasterDlg1.Raster = LEADRasterView1.Raster;
LEADRasterDlg1.UIFlags = DLG_FO_AUTOPROCESS | DLG_FO_PROGRESSIVE | DLG_FO_MULTIPAGE | DLG_FO_LOADROTATED | DLG_FO_LOADCOMPRESSED | DLG_FO_FILEINFO | DLG_FO_SHOWPREVIEW
nRet = LEADRasterDlg1.ShowOpenDlg(LEADRasterView1.Window);
if (nRet = 0)
LEADRasterView1.ForceRepaint ();
4. |
Run you page to test it. |