Adding a Color Resolution Dialog (JavaScript)

1.

Start with the project you created in Using Imaging Common Dialog

2.

Add the following code to add the imaging color common dialog COM object to your page:

<OBJECT ID="LEADRasterDlg2" NAME="LEADRasterDlg2"
   CLASSID="CLSID: 00140B4F-B1BA-11CE-ABC6-F5B2E79D9E3F"
   CODEBASE="path to CAB file/Ltrdg14n.cab">
   <P>This is not supported in the web browser.</P>
</OBJECT><BR>

3.

Add the following code between the <FORM> </FORM> tags to add a new command button:

<INPUT TYPE="button" NAME="btnColorRes" VALUE="Color Resolution" LANGUAGE="JavaScript"
   OnClick="ColorRes()">

4.

Add the following code between the <SCRIPT> </SCRIPT> tags:

function ColorRes()
{
   var DLG_CR_BITALL = 16383; 
   var DLG_CR_PAL_ALL = 1065353216; 
   var DLG_CR_DITHER_ALL = 8372224; 
   var DLG_CR_SHOWPREVIEW = 1; 
   var DLG_CR_AUTOPROCESS = 2; 
   var DLG_CR_ORDER = 32; 

   LEADRasterDlg1.BitsPerPixel = 0; 
   LEADRasterDlg1.PaletteFlags = 0; 
   LEADRasterDlg1. = 0; 
   LEADRasterDlg1.Raster = LEADRasterView1.Raster; //assign the bitmap for processing
   LEADRasterDlg1.ColorResFlags  = DLG_CR_BITALL | DLG_CR_PAL_ALL | DLG_CR_DITHER_ALL; 
   LEADRasterDlg1.UIFlags = DLG_CR_SHOWPREVIEW | DLG_CR_AUTOPROCESS | DLG_CR_ORDER; 
   LEADRasterDlg1.ShowColorResDlg(LEADRasterView1.Window);
   LEADRasterView1.ForceRepaint ();
}

5.

Run your page to test it.