Adding a Color Resolution Dialog (Visual Basic Script)

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="VBScript"
   OnClick="ColorRes">

4.

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

Sub ColorRes()
   Dim DLG_CR_BITALL
   Dim DLG_CR_PAL_ALL
   Dim DLG_CR_DITHER_ALL
   Dim DLG_CR_SHOWPREVIEW
   Dim DLG_CR_AUTOPROCESS
   Dim DLG_CR_ORDER

   DLG_CR_BITALL = 16383
   DLG_CR_PAL_ALL = 1065353216
   DLG_CR_DITHER_ALL = 8372224
   DLG_CR_SHOWPREVIEW = 1
   DLG_CR_AUTOPROCESS = 2
   DLG_CR_ORDER = 32

   LEADRasterDlg1.BitsPerPixel = 0
   LEADRasterDlg1.PaletteFlags = 0
   LEADRasterDlg1.DitherFlags = 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
End Sub

5.

Run your page to test it.