home *** CD-ROM | disk | FTP | other *** search
/ Prima Shareware 3 / DuCom_Prima-Shareware-3_cd1.bin / PROGRAMO / delphi / VCLFAQ / VCL2 / DELSEC05.FAQ next >
Encoding:
Text File  |  1995-04-07  |  26.4 KB  |  643 lines

  1. SECTION 5 - Delphi VCL
  2.  
  3. This document contains information that is most often provided
  4. to users of this section.  There is a listing of common
  5. Technical Information Documents that can be downloaded from 
  6. the libraries, and a listing of the most frequently asked
  7. questions and their answers.
  8.  
  9. Technical Information Documents related to VCL components:
  10.  
  11. None
  12.  
  13. Zip files related to VCL components:
  14.  
  15. MDI_BGRD.ZIP  Sample MDI application with a wallpaper background.
  16. CURREDIT.ZIP  Currency edit component.
  17.  
  18. Questions and answers:
  19.  
  20. Q.   "How can VCL components be created on the fly at run-time?"
  21.  
  22. A.   * The following code will create a modal password form at runtime.
  23.      The TPasswordForm type is a TForm descendent class defined either
  24.      in the current unit or in a separate unit referenced by the current
  25.      unit's uses clause.
  26.  
  27.      with TPasswordForm.Create(Application) do
  28.      begin                               ( i.e TForm1, TPasswordForm etc. } 
  29.         ShowModal;                       { Display form as a modal window }
  30.         Free;                            { Free the form when it is closed }
  31.      end;      
  32.  
  33.      * The following are the general steps to add a component to a form at 
  34.      run-time:  
  35.  
  36.      1. Declare an instance variable of the component type that you wish to
  37.         create {i.e. TButton }. Note: instance variables are used to point
  38.         to an actual instance of an object. They are not objects themselves.
  39.      2. Use the component's Create constructor to create an instance
  40.         of the component and assign the instance to the instance 
  41.         variable declared in step 1.  All components' Create constructors 
  42.         take a parameter - the component's owner.  Except in special 
  43.         circumstances, you should always pass the form as the owner 
  44.         parameter of the component's Create constructor.
  45.      3. Assign a parent to the component's Parent property (i.e. Form1,
  46.         Panel1, etc).  The Parent determines where the component will be 
  47.         displayed, and how the component's Top and Left coordinates are 
  48.         interpreted. To place a component in a groupbox, set the 
  49.         component's Parent property to the groupbox.  For a component
  50.         to be visible, it must have a parent to display itself within.
  51.      4. Set any other properties that are necessary  (i.e. Width, Height).
  52.      5. Finally, make the component appear on the form by setting the 
  53.         component's Visible property to True. 
  54.      6. If you created the component with an owner, you
  55.         don't need to do anything to free the component - it will be freed
  56.         when the owner is destroyed.  If you did not give the component an
  57.         owner when you created it, you are responsible for making sure
  58.         the component is freed when it is no longer needed.
  59.  
  60.      The following demonstrates how to add a TButton component to the 
  61.      current form at run-time:  
  62.  
  63.      var
  64.        TempButton : TButton;  { This is only a pointer to a TButton }    
  65.      begin 
  66.        TempButton := TButton.Create(Self); { Self refers to the form }
  67.        TempButton.Parent := Self;          { Must assign the Parent } 
  68.        TempButton.Caption := 'Run-time';   { Assign properties now }
  69.        TempButton.Visible := True;         { Show to button }
  70.      end; 
  71.  
  72.      Since the button was created with an owner, it will be freed 
  73.      automatically when its owner, the form, is freed.     
  74.  
  75.  
  76. Q.   "How can the event handler of a popup menu item determine which 
  77.       component was right-clicked upon to activate that menu?
  78.  
  79. A.    Use the PopupMenu.PopupComponent property 
  80.       to determine what control the menu was activated for.
  81.  
  82.       procedure TForm1.PopupItem1Click(Sender: TObject);
  83.       begin
  84.         Label1.Caption := PopupMenu1.PopupComponent.ClassName;
  85.       end;
  86.  
  87.       The form's ActiveControl property can also be used, however, 
  88.       the active control may not necessarily be the control that
  89.       caused the popup menu to appear. 
  90.  
  91.  
  92. Q.    "What are the capacity limits of the standard Delphi controls?"
  93.  
  94. A.    Any component that uses a TList to store information has an upper
  95.       bound of 16368 items. For example, a TTabControl can contain up to
  96.       16368 tabs and the Delphi Component Palette can contain up to
  97.       16368 palette pages.
  98.  
  99.       Many of the Delphi standard components are wrappers around standard
  100.       Windows controls.  Windows 3.1 imposes its own limits on these 
  101.       components.  For example: a TComboBox or TListbox can hold up to
  102.       5440 items and TMemo or TEdit (and related components) can hold up 
  103.       to 32k of text.
  104.  
  105.       Windows 3.1 resource space imposes a limit of 570 pages in a 
  106.       TNoteBook component. (It's difficult to get more than 500 window 
  107.       handles in any Windows application.)
  108.  
  109.       Note 1: Exceeding these limits will raise exceptions or cause Windows
  110.       to behave strangely.
  111.  
  112.       Note 2: Many of the Windows-based capacity limits are much higher 
  113.       in the 16-bit WOW box of Windows NT and in Windows 95.  In future
  114.       32 bit releases of Delphi, virtually all of these limits will 
  115.       disappear.
  116.  
  117.  
  118. Q.    How can I determine the Length in pixels of a string after a
  119.       specific font has been aplied to it.
  120.  
  121. A.    Use the Canvas methods TextHeight and TextWidth to
  122.       determine the text height and width of a string in
  123.       pixels.  Be sure to assign the font into the Canvas before
  124.       drawing or taking measurements.
  125.  
  126.       All visual components have a Canvas property, but
  127.       usually this property is protected so that only direct descendents
  128.       can draw on the Canvas.  Since you write much of your code
  129.       inside methods of a TForm descendent, you always have access to 
  130.       your form's inherited Canvas property.  The TPaintBox component
  131.       makes its Canvas property public so that you can draw on the
  132.       component from OnPaint event methods in the form.
  133.  
  134.       If a component doesn't have a Canvas property you can use the
  135.       following function to get the text width based on the font passed.
  136.  
  137.       function GetTextWidth(CanvasOwner: TForm; Text : String;
  138.                           TextFont :  TFont): Integer;
  139.       var
  140.         OldFont : TFont;
  141.       begin
  142.         OldFont := TFont.Create;
  143.         try
  144.           OldFont.Assign( CanvasOWner.Font );
  145.           CanvasOWner.Font.Assign( TextFont );
  146.           Result := CanvasOwner.Canvas.TextWidth(Text);
  147.           CanvasOWner.Font.Assign( OldFont );  
  148.         finally
  149.           OldFont.Free;
  150.         end;
  151.       end;
  152.  
  153.  
  154. Q.   Why do some visual components like TPanel and TEdit not have a
  155.      Canvas property?
  156.  
  157. A.   All descendents of TCustomControl have a Canvas property, however,
  158.      most are protected to prevent 'outsiders' from drawing on the
  159.      component.  Descendents of a component can always access the 
  160.      protected properties they inherit from the component 
  161.      (such as Canvas), but users of the component cannot.
  162.  
  163.      type
  164.         TCanvasPanel = class(TPanel)
  165.         public
  166.           property Canvas;
  167.         end;
  168.  
  169.      If you want to draw on a component that doesn't have a public 
  170.      canvas property, consider using a different component that was 
  171.      intended for arbitrary drawing (TPaintBox), or layer components to 
  172.      achieve the desired result (client-align a TPaintBox inside a TPanel
  173.      to get a bevelled, drawable area).
  174.  
  175.  
  176. Q.   "How can I get a horizontal scrollbar on a list box?"
  177.  
  178. A.   Send a LB_SetHorizontalExtent message to the listbox's window handle.
  179.      For example, the message could be sent in the form's OnCreate:
  180.  
  181.      procedure TForm1.FormCreate(Sender: TObject);
  182.      begin
  183.       SendMessage(Listbox1.Handle, LB_SetHorizontalExtent, 
  184.                   1000, Longint(0));
  185.      end;
  186.  
  187. Q.   "Does Delphi have a component that supports serial communications?"
  188.  
  189. A.   No. However, there are serial communications libraries (and soon 
  190.      Delphi components) for Delphi available from third party vendors
  191.      such as TurboPower, SaxComm, and and others.
  192.  
  193.  
  194. Q.   "How can the tab stops be set in a TMemo control?"
  195.  
  196. A.   To change the tab stops for a multiline edit control
  197.      (i.e. a TMemo) send the EM_SetTabStops message to the
  198.      component.  The Tabs array indicates where the tab stops 
  199.      will be located.  Since the WParam parameter to 
  200.      SendMessage is 1, then all tab stops will be set to the 
  201.      value passed in the Tabs array.  Remember to set the
  202.      WantTabs property of TMemo to True to enable the tabs.
  203.  
  204.      procedure TForm1.FormCreate( Sender : TObject );
  205.      const
  206.         TabInc : LongInt = 10;
  207.      begin
  208.        SendMessage( Memo1.Handle, EM_SetTabStops, 1,
  209.           Longint( @TabInc ) );
  210.      end;
  211.  
  212.  
  213. Q.   "Where is the best place to open a splash screen on program
  214.      start up?"
  215.  
  216. A.   The best place to open a splash screen is in the project source 
  217.      file after the first Application.FormCreate and before the
  218.      Application.Run.  This is accomplished by creating a form on
  219.      the fly and then displaying it before the application is actual
  220.      opened.
  221.  
  222.      program Project1;
  223.  
  224.      uses Forms,  
  225.           Unit1 in 'UNIT1.PAS' {Form1}, 
  226.           Splash;
  227.  
  228.      {$R *.RES}
  229.      var
  230.        SplashScreen : TSplashScreen;  {in the Splash unit}
  231.      begin
  232.      Application.CreateForm(TForm1, Form1);
  233.      SplashScreen := TSplashScreen.Create(Application);
  234.      try
  235.        SplashScreen.Show;
  236.        SplashScreen.Update;
  237.        {
  238.         do other CreatForms or anyother processing 
  239.         before the app is to be opened
  240.        }
  241.      finally               {Make sure the splash screen gets released}
  242.        SplashScreen.Free; 
  243.      end;   
  244.      Application.Run;
  245.      end.
  246.  
  247.  
  248. Q.   "Why does the OnExit event of a TEdit component not execute when 
  249.      the user clicks on a speed button?  Is there a way to make a 
  250.      an OnExit event execute when a speed button is pressed?"
  251.  
  252. A.   A speed button never actually gets focus, so the active
  253.      control never loses its focus, consequently the active
  254.      control's OnExit event never occurs. 
  255.  
  256.      One way to execute the active control's OnExit event is to
  257.      explicitly call it in the OnClick event of the speedbutton. 
  258.      For example:
  259.  
  260.      procedure TForm1.SpeedButton1Click(Sender: TObject);
  261.      begin
  262.        If ActiveControl is TEdit then 
  263.           (ActiveControl as TEdit).OnExit(ActiveControl);
  264.      end;
  265.  
  266.   
  267. Q.   "When I open the child windows at run-time each one is 
  268.      positioned slightly down and to the right of the previous
  269.      window.  My problem is that if I then close some of the child 
  270.      windows and then open a new one, the new one is placed 
  271.      down and to the right of where the last child window was 
  272.      before I closed it, even though it is no longer there! 
  273.      Is this as designed?"  
  274.  
  275. A.   That's how MDI windows works. VCL doesn't override Windows
  276.      default behavior in this situation.
  277.  
  278.      Untested suggestion: In the FormCreate procedure try 
  279.      setting the Top, Left, Width & Height properties to the values
  280.      that you require.  The MDI child form's FormCreate is called 
  281.      before the window is displayed.
  282.  
  283.  
  284. Q.   "Why can't my program find any of the resources that I put in a .RES 
  285.      file if that .RES file is the same name as my form's unit name?"
  286.  
  287. A.   If the name of an included .RES file is the same as the name
  288.      of a .DPR file Delphi wll overwrite it with it's own .RES file.  
  289.      In addition, the project RES file is for the Delphi project
  290.      manager only; don't edit or add resources to this RES file.  
  291.  
  292.  
  293. Q.   "How can you do scrolling functions in a TForm component using 
  294.       keyboard commands?  For example, scrolling the form up and down 
  295.       with the PgUp and PgDn keys.  
  296.  
  297. A.    Form scrolling is accomplished by modifying the VertScrollbar 
  298.       or HorzScrollbar Postion properties of the form.  The following
  299.       code demonstrates how to do this:
  300.  
  301.       procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  302.       Shift: TShiftState);
  303.       const
  304.         PageDelta = 10;
  305.       begin
  306.         With VertScrollbar do
  307.           if Key = VK_NEXT then  Position := Position+PageDelta
  308.           else if Key = VK_PRIOR then Position := Position-PageDelta;
  309.       end;
  310.  
  311.       Note: This may not work well if the active control uses PgUp & PgDn,
  312.       too, like a TMemo.
  313.  
  314.  
  315. Q.    "Is there a way to fill a TListbox or TMemo in one shot?"
  316.  
  317. A.    To fill multiple lines of a TListbox or TMemo component the SetText
  318.       method can be used.  The null terminated string passed to the 
  319.       SetText method is a concatination of each line of text delimeted
  320.       by a carriage return character #13 in between.  For example, 
  321.      the follow statement:
  322.  
  323.       Listbox1.Items.SetText('aaaaa'#13'bbbbb'#13'ccccc')
  324.  
  325.       will display the following in a listbox window:
  326.  
  327.       aaaaa
  328.       bbbbb
  329.       ccccc
  330.  
  331.       Note: The preferred method of filling a listbox or memo is with the
  332.       Add method of their Items and Lines properties, respectfully.
  333.  
  334.  
  335. Q.    "Is it possible to create something like the Control Array in Visual
  336.       Basic?   For example, I want a group of buttons with a common event
  337.       handler whereby the event handler picks up an integer value for the
  338.       particular button. In Visual Basic this would be done via the
  339.       Control Array index."
  340.  
  341. A.    One way do to this is to set the Tag field for each button to a
  342.       different number and then create a common OnClick event handler
  343.       that looks at the Sender's Tag field.  Assign the same OnClick
  344.       event handler to all the buttons in the group.  And then the
  345.       OnClick event handler would look something like this:
  346.  
  347.       procedure TForm1.Button1Click(Sender: TObject); var cap: string;
  348.       begin
  349.         case TButton(sender).Tag of
  350.           1: ShowMessage('1st Button Pressed');
  351.           2: ShowMessage('2nd Button Pressed');
  352.           3: ShowMessage('3rd Button Pressed');
  353.         end;
  354.       end;
  355.  
  356.  
  357. Q.    "How can a new component be added to a page of a
  358.       TTabbedNoteBook at run time?  How do I determine 
  359.       what the parent will be for the new component?"
  360.  
  361.  
  362. A.    To add a component to a TabbedNotebook page at run-time a
  363.       pointer to the desired page must be assigned to the new
  364.       component's Parent property before it can be shown.  The way to 
  365.       access all the pages of a TTabbedNotebook at run-time is with 
  366.       the Objects array property of the TabbedNotebook's Pages property.
  367.       In other words, the page components are stored as objects attached
  368.       to the page names in the Pages string list property.  The follow
  369.       demonstrates the creation of a button on the second page of
  370.       TabbedNotebook1:
  371.  
  372.       var 
  373.         NewButton : TButton;
  374.       begin
  375.         NewButton := TButton.Create(Self);
  376.         NewButton.Parent := TWinControl(TabbedNotebook1.Pages.Objects[1])
  377.       ...               
  378.      
  379.      This is how a TNotebook page would be used as a parent to a newly 
  380.      created component on that page: 
  381.     
  382.      NewButton.Parent := TWinControl(Notebook1.Pages.Objects[1])
  383.  
  384.      This is how a TTabSet tab page would be used as a parent to a
  385.      newly created component on that tab page: 
  386.     
  387.      NewButton.Parent := TWinControl(TabSet1.Tabs.Objects[1])
  388.  
  389.  
  390. Q.   "Are there any vertical ( side of the page ) tab components
  391.      available, commercial, shareware or freeware."
  392.  
  393. A.   TurboPower's Orpheus product will support this. GO TURBOPOWER
  394.      for more information.
  395.  
  396.  
  397. Q.   "Is there an easy way to get CopyToClipboard, CutToClipboard etc. 
  398.      to know to use the TEdit that has focus?  
  399.  
  400. A.   Simply check to see if the ActiveControl is of type TEdit and then 
  401.      do the desired cut, copy or paste operation. For example:
  402.  
  403.      if (ActiveControl is TEdit) then
  404.         TEdit(ActiveControl).CopyToClipboard;     
  405.  
  406.  
  407. Q.   "Does a TDBGrid component have an OnMouseDown, OnMouseUp and 
  408.      OnMouseMove events?"
  409.  
  410. A.   The events are there, but they aren't published.  You could 
  411.      create a simple decendant of TDBGrid and publish them.
  412.  
  413.  
  414. Q.   "Does Delphi grab system resources when displaying and closing
  415.      modal dialogs?  For example, the following code decreases the
  416.      system resources every time it is used to show a modal dialog."
  417.  
  418.      ModalForm1 := TModalForm1.Create(Self);
  419.      ModalForm1.ShowModal;
  420.  
  421. A.   Without an OnClose event handler that sets Action parameter to
  422.      caFree, your code is creating a new form with each call to
  423.      TModalForm1.Create(Self), but the previously created form is
  424.      never destroyed.  All previous instances of the "ModalForm1"
  425.      forms are floating around in Windows.
  426.  
  427.     The Free method of a form can also be used to free its resources.
  428.     This is demonstrated below:
  429.  
  430.      try
  431.        ModalForm1.ShowModal;
  432.       { other stuff here }
  433.      finally
  434.        ModalForm1.Free;
  435.      end;
  436.  
  437.  
  438. Q.   What is the best way to create a radio button group and
  439.      place radio buttons on it?  It seems that you can create a
  440.      Radio Group then drop Radio Buttons on it or you can 
  441.      create the group and enter values into the Items properties
  442.      for the titles (captions) of the radio buttons and have
  443.      Delphi place them in the group.      
  444.  
  445. A.   If you're going to use a radio group, you need to create your
  446.      radio buttons using the Items string list.  Radio buttons
  447.      don't have to be in a group, which is why the plain radio 
  448.      button component is available.
  449.  
  450.  
  451. Q.   "Is there a way to make sure the window that is holding a form 
  452.      or an image component is byte-aligned?" 
  453.  
  454. A.   Override the CreateParams method:
  455.  
  456.      procedure TMyForm.CreateParams(var Params:TCreateParams);
  457.      begin
  458.        inherited CreateParams(Params);
  459.        Style := Style or CS_BYTEALIGNWINDOW;
  460.      end; 
  461.  
  462.      Note: Byte alignment is less of a big deal than the Windows docs
  463.      imply.  It is only significant on monochrome, EGA, and 16 color
  464.      VGA video modes. All higher video modes are always byte-aligned.
  465.  
  466.  
  467. Q.   What is the order of event handlers when a form is created 
  468.      and shown?
  469.  
  470. A.   When a form is created the event handlers are executed in the
  471.      following order:  OnCreate, OnShow, OnPaint, OnActivate, OnResize
  472.      and OnPaint again. 
  473.  
  474.  
  475. Q.   "Why does the error 'Cannot change Visible in OnShow or OnHide'
  476.      occur when the FormStyle property of a form is changed in the
  477.      OnActivate event? 
  478.  
  479. A.   The FormStyle property defines how the window gets created and 
  480.      is usually set in the OnCreate event, however, it can changed 
  481.      after the window handle has been created, just not during the
  482.      OnActivate, OnShow or OnHide events.  The issue here is with the
  483.      mode that the system is in during OnShow and OnHide events.
  484.  
  485.  
  486. Q.   "How can I make components look sunken and raised?
  487.  
  488. A.   To make a component look raised or lowered place it on  
  489.      a TBevel or TPanel component which both have properties to
  490.      raise or lower their frames.
  491.  
  492.  
  493. Q.   Where is the source code for the tabbed controls (i.e.
  494.      TTabbedNotebook)?
  495.  
  496. A.   The source code files shipped with Delphi does not contain the
  497.      source for the tabbed controls because of legal reasons. However,
  498.      the interface source for the tabbed controls is provided
  499.      in the DELPHI\DOC directory with an INT extension.
  500.     
  501.      Note:  Registered owners of the Delphi RTL source code can request
  502.      the TTabSet and TTabbedNotebook source code from Borland Corporate
  503.      Affairs.  Instructions are in the RTL source readme.
  504.  
  505.  
  506. Q.    "What is the memo field size in Delphi?"
  507.  
  508. A.    Microsoft's edit control that is built-in to Windows and used 
  509.       by Delphi's TEdit and TMemo wrapper classes has a maximum 
  510.       capacity of 32k.  The Delphi wrapper classes do some special
  511.       things  to allow every edit and memo control on a form to
  512.       contain up to 32k each.  Normally all edit controls in an
  513.       application would be limited to 32k collectively.
  514.  
  515.  
  516. Q.    "How can I make a field in the TGrid component not show up?"
  517.  
  518. A.    This can be accomplished by either removing the field entirely 
  519.       from the Fields Editor's field list or by setting the Visible
  520.       property of the field to False. 
  521.  
  522.  
  523. Q.    "Is there a way to put a wallpaper background on an MDI 
  524.        application?"
  525.  
  526. A.    There is a sample application that demostrates this in the VCL
  527.       section (5) of the Delphi forum under the name of MDI_BGRD.ZIP.  
  528.  
  529.  
  530. Q.    "Does Delphi have a currency/money component?"
  531.  
  532. A.    No, bu there is a currency edit component in the VCL section of the
  533.       Delphi forum under the name of CURREDIT.ZIP.  
  534.  
  535.  
  536. Q.    "Where can I find out about VBX datatypes (i.e. TBasicString) and
  537.       the functions to manipulate these datatypes?"
  538.       
  539. A.    First off, all VBX related datatypes and functions are in the 
  540.       VBXCtrls unit which is Borland propriatary unit.  Delphi does,
  541.       however, provide the interface section of this unit is in the
  542.       \DELPHI\DOC directory under the name of VBXCTRLS.INT.  This is the
  543.       only real source of information on the contents of the VBXCtrls unit.
  544.  
  545.  
  546. Q.    "What issues do I need to be aware of when developing applications
  547.       that will be ran on different screen resolutions (form scaling)?"
  548.  
  549. A.    The following are issue to bear in mind when scaling Delphi
  550.       applications (forms) on different screen resolutions?
  551.  
  552.     * Decide early on in the form design stage whether you're going to 
  553.       allow the form to be scaled or not.  The advantage of not scaling is
  554.       that nothing changes at runtime.  The disadvantage of not scaling is
  555.       that nothing changes at runtime (your form may be far too small or
  556.       too large to read on some systems if it is not scaled).
  557.  
  558.     * If you're NOT going to scale the form, set Scaled to False.
  559.  
  560.     * Otherwise, set the Form's Scaled property to True.
  561.  
  562.     * Set AutoScroll to False.  AutoScroll = True means 'don't change the
  563.       form's frame size at runtime' which doesn't look good when the 
  564.       form's contents do change size.
  565.  
  566.     * Set the form's font to a scaleable TrueType font, like Arial.  
  567.       MS San Serif is an ok alternate, but remember that it is still a 
  568.       bitmapped font.  Only Arial will give you a font within a pixel of
  569.       the desired height.  NOTE: If the font used in an application is not
  570.       installed on the target computer, then Windows will select an 
  571.       alternative font within the same font family to use instead. 
  572.       This font may not match the same size of the original font any may
  573.       cause problems.
  574.  
  575.     * Set the form's Position property to something other than poDesigned. 
  576.       poDesigned leaves the form where you left it at design time, which
  577.       for me always winds up way off to the left on my 1280x1024 screen - 
  578.       and completely off the 640x480 screen.
  579.  
  580.     * Don't crowd controls on the form - leave at least 4 pixels between 
  581.       controls, so that a one pixel change in border locations (due to 
  582.       scaling) won't show up as ugly overlapping controls.
  583.  
  584.     * For single line labels that are alLeft or alRight aligned, set
  585.       AutoSize to True.  Otherwise, set AutoSize to False.
  586.  
  587.     * Make sure there is enough blank space in a label component to allow
  588.       for font width changes - a blank space that is 25% of the length of
  589.       the current string display length is a little too much, but safe.
  590.       (You'll need at least 30% expansion space for string labels if you 
  591.       plan to translate your app into other languages) If AutoSize is 
  592.       False, make sure you actually set the label width appropriately. 
  593.       If AutoSize is True, make sure there is enough room for the label 
  594.       to grow on its own.
  595.  
  596.     * In multi-line, word-wrapped labels, leave at least one line of
  597.       blank space at the bottom.  You'll need this to catch the overflow
  598.       when the text wraps differently when the font width changes with
  599.       scaling. Don't assume that because you're using large fonts, you
  600.       don't have to allow for text overflow - somebody else's large 
  601.       fonts may be larger than yours!
  602.  
  603.     * Be careful about opening a project in the IDE at different
  604.       resolutions.  The form's PixelsPerInch property will be modified
  605.       as soon as the form is opened, and will be saved to the DFM if
  606.       you save the project. It's best to test the app by running it
  607.       standalone, and edit the form at only one resolution. Editing
  608.       at varying resolutions and font sizes invites component drift 
  609.       and sizing problems.
  610.  
  611.     * Speaking of component drift, don't rescale a form multiple times,
  612.       at design time or a runtime.  Each rescaling introduces roundoff
  613.       errors which accumulate very quickly since coordinates are 
  614.       strictly integral.  As fractional amounts are truncated off
  615.       control's origins and sizes with each successive rescaling, 
  616.       the controls will appear to creep northwest and get smaller.
  617.       If you want to allow your users to rescale the form any number 
  618.       of times, start with a freshly loaded/created form before each 
  619.       scaling, so that scaling errors do not accumulate.
  620.  
  621.     * Don't change the PixelsPerInch property of the form, period.
  622.  
  623.     * In general, it is not necessary to design forms at any particular
  624.       resolution, but it is crucial that you review their appearance at
  625.       640x480 with small fonts and large, and at a high-resolution with
  626.       small fonts and large before releasing your app.  This should be 
  627.       part of your regular system compatibility testing checklist.
  628.  
  629.     * Pay close attention to any components that are essentially 
  630.       single-line TMemos - things like TDBLookupCombo.  The Windows 
  631.       multi-line edit control always shows only whole lines of text - 
  632.       if the control is too short for its font, a TMemo will show 
  633.       nothing at all (a TEdit will show clipped text). For such 
  634.       components, it's better to make them a few pixels too large than
  635.       to be one pixel too small and show not text at all.
  636.  
  637.     * Keep in mind that all scaling is proportional to the difference 
  638.       in the font height between runtime and design time, NOT the pixel
  639.       resolution or screen size.  Remember also that the origins of your
  640.       controls will be changed when the form is scaled - you can't very 
  641.       well make components bigger without also moving them over a bit.
  642.  
  643.