home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 September / Chip_2001-09_cd1.bin / zkuste / delphi / kolekce / d123456 / DFS.ZIP / DFSLayeredForm.txt < prev    next >
Text File  |  2001-06-28  |  11KB  |  213 lines

  1. TdfsLayeredForm v1.00 Beta 3
  2.  
  3. Description:
  4.    A TForm descendent class that provides access to the features of "layered
  5.    windows" which are new in Windows 2000.  Layered windows can be translucent
  6.    (they blend with the things behind them, making it appear as though they are
  7.    "see through"), have transparent sections (areas that do not exist at all
  8.    allowing you to make non-rectangular windows similar to the way SetWindowRgn
  9.    works), or both.  The benefit of using the transparency of a layered window
  10.    vs. SetWindowRgn is that you don't have to construct a region that describes
  11.    the non-rectangular area, you simple paint all the area in one color and
  12.    choose that color as the transparent color.
  13.  
  14.    NOTE: "Layered windows" were introduced in Windows 2000 and are NOT supported
  15.    on prior versions of Windows (95, 98, NT 4).  There should be no detremental
  16.    effects of using it on a previous OS, the form will simply behave as a
  17.    standard TForm.
  18.  
  19. Contact Information:
  20.   The lateset version will always be available on the web at:
  21.     http://www.delphifreestuff.com
  22.   If you have any questions, comments or suggestions, please use the Delphi
  23.   Free Stuff Support Forum at: 
  24.     http://www.delphifreestuff.com/discus/
  25.   If, for some reason, you can not use the web-based support forum, you can
  26.   email me at bstowers@delphifreestuff.com.  However, the support forum will
  27.   always take precedence over direct email since it provides a resource that
  28.   others can use when they have a problem.  Every message posted to the forum
  29.   is emailed directly to this account, so emailing me directly will not get 
  30.   your message to me any faster.  It will only make the message less important
  31.   for me to respond to since only one person (you) is benefiting from it
  32.   instead of everyone interested.  Having said all that, please do email me 
  33.   directly if it is regarding something that isn't really support related, 
  34.   i.e. just to say thanks (as novel as that idea is).  
  35.  
  36.  
  37. Installation:
  38.   Delphi 1:
  39.     * Delphi 1 is not supported.
  40.     
  41.   Delphi 2, C++Builder 1:
  42.     * TdfsLayeredForm has not been tested on, and does not officially support 
  43.       Delphi 2 or C++Builder 1.  However, you should be able to simply place 
  44.       the files in the directory of your choosing.  There is no component 
  45.       involved.
  46.  
  47.   Delphi 3, 4, 5, C++Builder 3 & 4:
  48.     * Do one of the following:
  49.       + Create a new package by selecting File | New and choosing Package from
  50.         the New tab in the dialog.
  51.       + Open an existing package file.  I suggest you do this if you already 
  52.         have a package that you like to use for small, third party components.
  53.         I specifically have a package named "3rdParty.dpk" that I use for 
  54.         small components that come from other people.  Or, if you are using
  55.         several of my components, you might create a "DFS.dpk" package and 
  56.         use it for all of my DFS components.
  57.     * In the resulting package window, click the Add button.
  58.     * In the Add dialog, on the Add Unit tab, enter the full path name of the 
  59.       component's registration unit (the unit that ends with 'Reg.pas', i.e. 
  60.       'BrowseDrReg.pas') and click OK.
  61.     * You may want to add the other source files (*.pas) to the package as 
  62.       well in the same manner as you did the registration unit.  While this is
  63.       not required, not doing it will cause compiler warnings when the package
  64.       is compiled.  The component will function fine either way, but I 
  65.       personally find the warnings very irritating and am not happy until 
  66.       every compiler warning and hint is gone.
  67.     * If this package is new, or it has never been installed, click the 
  68.       Install button in the package window.  If this package is already 
  69.       installed in Delphi, click the Compile button.
  70.       Note that this will NOT add any items to your component palette.  
  71.       TdfsDSAForm is not a component, but a TForm descendant class.  So, 
  72.       instead of a component palette icon, you will instead have a new "DFS" 
  73.       tab added to the Object Repository (File | New).  If you prefer a tab
  74.       name other than "DFS", you can edit the sLayeredFormObjRepositoryPage
  75.       constant in DFSLayeredFormReg.pas and recompile the package.  Note that
  76.       you can use the name of an existing tab ("Forms" for example) to have the
  77.       items added there.
  78.  
  79.   C++Builder 5 and up:
  80.     * Perform the "Delphi 3 and up, C++Builder 3 and up" steps above, except
  81.       for the last step (Compile or Install).
  82.     * Select the package the component has been added to, and choose 
  83.       Project | Edit Option Source to open the package options in the editor.
  84.     * In the entry for PFLAGS, add the "-LUvcl50" option.  For example:
  85.         <PFLAGS value="-$YD -$W -$O -v -JPHNE -M -LUvcl50"/>
  86.     * Perform the final step from above, Compile or Install.
  87.     * For Borland's official word on this situation, open the C++Builder help
  88.       file and search the index for "dsgnintf.dcu" and see the "Compiling
  89.       packages with DsgnIntf" section.
  90.  
  91.   Delphi 6 and up:
  92.     * Perform the "Delphi 3, 4, 5, C++Builder 3 & 4" steps above, except
  93.       for the last step (Compile or Install).
  94.     * Add the DesignIDE package to the Requires list of the package into which
  95.       the component is being installed.
  96.     * Perform the final step from above, Compile or Install.
  97.     * This is necessary because of changes to the design-time support units
  98.       introduced in Delphi 6.  For complete information, see the Del6New.hlp
  99.       file in your Delphi 6 Help directory.  In the index, search for
  100.       "upgrade issues" and in the resulting list of topics, select the
  101.       "DsgnIntf renamed and related changes" topic.
  102.  
  103.  
  104. Design-Time Access to TdfsLayeredForm Properties:
  105.   NOTE:  This information applies only to Delphi 3 and above, and C++Builder 3
  106.          and above.  Previous versions of Delphi and C++Builder do NOT support
  107.          design-time access of TForm descendants.  Sorry.  You can should still
  108.          be able to use this class with those prior versions, you just won't 
  109.          have access to the new properties at design-time, only in your code at 
  110.          run-time.
  111.   * Create a new application project.
  112.   * Select File | New and choose the "DFS" tab in the Object Repository window.
  113.   * Select the "Layered Form" item and click the OK button.
  114.   * You should now have a new TdfsLayeredForm type form added to the project, and
  115.     when you select it all new properties should be visible in the IDE.
  116.  
  117.  
  118. Delphi 2, and C++Builder 1 Notes:
  119.   * Although not officially supported, you may be able to use this class with 
  120.     Delphi 2 and/or C++Builder 1 by following these directions.
  121.     The best way to use this form is to add it to your Object Repository.
  122.     Simply open this unit in Delphi, right click on the form and select Add
  123.     To Repository.  Then, when you want a TdfsLayeredForm, you just select it
  124.     from the repository (File | New) and use the "Inherit" option so you
  125.     don't have to see all this code in your form.
  126.  
  127.     Delphi 1 & 2: If you have existing forms that you want converted to layered
  128.     forms, simply add "DFSLayeredForm" to your "Uses" clause, and change your
  129.     form's ancestor to TdfsLayeredForm.  An example:
  130.        Change:
  131.           TMyForm = class(TForm)
  132.        To:
  133.           TMyForm = class(TdfsLayeredForm)
  134.  
  135.     C++Builder 1: To convert existing forms, add the DFSLayeredForm.pas file to
  136.       the project (using Project Manager), then open the form's header file and
  137.       add:
  138.  
  139.        #include "dfslayeredform.hpp"
  140.  
  141.     above the form class declaration.  Next, change the form's class declaraion:
  142.       Change:
  143.         class TForm1 : public TForm
  144.       To:
  145.         class TForm1 : public TdfsLayeredForm
  146.  
  147.     And finally, change the form's constructor in the source (.cpp) file:
  148.       Change:
  149.         __fastcall TForm1::TForm1(TComponent* Owner)
  150.           : TForm(Owner)
  151.         {
  152.       To:
  153.         __fastcall TForm1::TForm1(TComponent* Owner)
  154.           : TdfsLayeredForm(Owner)
  155.         {
  156.  
  157. Documentation:
  158.   * MousePassthrough: boolean
  159.     This property, when set to TRUE, will pass all mouse clicks through to the
  160.     window underneath the TdfsLayeredForm.  Normally, only transparent areas are
  161.     treated in this manner.  You may find this useful if you are doing some sort
  162.     of informational display where the form is very translucent and is not meant
  163.     to be interacted with.  Note that the form will still react to keyboard
  164.     messages when it has focus (i.e. Alt-F4 will close it).
  165.   * Opacity: byte
  166.     This property controls how translucent the form will be.  The allowable
  167.     range is from 0 to 255, where 0 is completely invisible and 255 is
  168.     completely opaque (appears as any other window).
  169.   * UseOpacity: boolean
  170.     Controls whether the form is translucent or not.  When set to TRUE, the
  171.     amount of translucency for the form is controlled by the Opacity property.
  172.   * TransparentColor: TColor
  173.     Defines the color that should be removed from the form.  All visible
  174.     elements on the form of this color will be completely removed, thus allowing
  175.     you to create non-rectangular windows, or non-standard window shapes.  Note
  176.     that this applies only the client area, not the non-client area (i.e. the
  177.     title bar is unaffected).
  178.   * UseTransparentColor: boolean
  179.     Controls whether the form has transparent areas or not.  If set to TRUE,
  180.     all areas on the form that match the color in the TransparentColor property
  181.     will be removed from the form.
  182.  
  183.  
  184. Notes:
  185.   * Delphi 6 has added transparency support to TForm (see AlphaBlend,
  186.     AlphaBlendValue, TransparentColor and TransparentColorValue properties).
  187.     I have not investigated these new properties enough to know whether
  188.     I should continue work on this "component" or not.  When I have time
  189.     to review the new D6 stuff, I may decide to drop this component.
  190.   * Transparency means that part of the window does not exist.  If you click
  191.     on a transparent area of the form, that click gets passed through to
  192.     whatever window is underneath it.
  193.   * This component was inspired by an article in Windows Developers Journal.
  194.     I didn't even realize this stuff was in Windows 2000 until I saw it
  195.     discussed in the May 2000 issue.
  196.   * For further reading on the new "layered windows" in Windows 2000, see the
  197.     paper written by Vadim Gorokhovsky and Lou Amadio on Microsoft's site at
  198.     http://msdn.microsoft.com/library/techart/layerwin.htm
  199.  
  200.  
  201. Known Issues:
  202.   * There are no known issues at this time.
  203.  
  204.  
  205. Revision History:
  206.   Beta 3:  + Updated for Delphi 6 compatibility.  See updated install directions
  207.              above.
  208.   Beta 2:  + Wouldn't run on non-Windows 2000 systems.  I had directly linked to
  209.              the new external API functions instead of dynamically loading them.
  210.              Thanks to Jon Robertson for sending me the fixed code.
  211.            + Updated for C++Builder 5 compatibility.
  212.   1.00:    + Initial release
  213.