Using Transparent Controls (JavaScript)

The following example creates a web page with a bitmap as its background, then places a RasterView control on. You can then press the button at the bottom of the page to toggle the transparency of the control.

1.

Create an new HTML file and copy the following code to it ans save:

<HTML>
<HEAD>   
   <SCRIPT LANGUAGE="JavaScript">
   <!--
   function Window_OnLoad()
   {
      LEADRasterView1.RasterUnk.CreateBitmap(500, 150, 24); 
      RasterProc.Fill(LEADRasterView1.RasterUnk, 255); 

      RasterFxd.TextTop = 50; 
      RasterFxd.TextLeft = 0; 
      RasterFxd.TextWidth = LEADRasterView1.DstWidth
      RasterFxd.TextHeight = LEADRasterView1.DstHeight
      RasterFxd.DrawFontColor = 65353; 
      RasterFxd.Font.Size = 18; 
      RasterFxd.DrawPersistence = true; 
      RasterFxd.DrawText(LEADRasterView1.RasterUnk, 0, "Press the button below to toggle transparency", 0); 
   }

   function ToggleTransparency()
   {
      if (LEADRasterView1.Transparent == true) 
         LEADRasterView1.Transparent = false; 
      else
         LEADRasterView1.Transparent = true; 
   }
   //-->
   </SCRIPT>

      <TITLE>LEADTOOLS JavaScript COM Example</TITLE>
      
   </HEAD>
   
   <BODY OnLoad = "Window_OnLoad()" BACKGROUND="c:\save.jpg">
      <OBJECT CLASSID="clsid:5220cb21-c88d-11cf-b347-00aa00a28331"
         ALIGN="baseline" 
         BORDER="0" 
         WIDTH="1" 
         HEIGHT="1">
         <PARAM NAME="LPKPath" VALUE="path to LPK file/LTOCX14n.Lpk">
      </OBJECT><BR>
      
      <OBJECT ID="LEADRasterView1" NAME="LEADRasterView1" 
         CLASSID="CLSID:00140708-B1BA-11CE-ABC6-F5B2E79D9E3F"
         CODEBASE="path to CAB file/Ltrvw14n.cab" 
         ALIGN="baseline" 
         BORDER="0"
         WIDTH="90%" 
         HEIGHT="90%">
         <P>This is not supported in the web browser.</P>
      </OBJECT><BR>
      
      <OBJECT ID="RasterFxd" NAME="RasterFxd" 
         CLASSID="CLSID:0014072B-B1BA-11CE-ABC6-F5B2E79D9E3F"
         CODEBASE="path to CAB file/Ltrfd14n.cab">
         <P>This is not supported in the web browser.</P>
      </OBJECT><BR>
      
      <OBJECT ID="RasterProc" NAME="RasterProc" 
         CLASSID="CLSID:00140712-B1BA-11CE-ABC6-F5B2E79D9E3F"
         CODEBASE="path to CAB file/Ltrpr14n.cab">
         <P>This is not supported in the web browser.</P>
      </OBJECT><BR>
      
      <FORM NAME="LEADForm">
      <INPUT TYPE="button" NAME="btnToggleTransparency" VALUE="Toggle Transparency" LANGUAGE="JavaScript"
         OnClick="ToggleTransparency()">
      </FORM>
   </BODY>
</HTML>

2.

Run your page to test it.