home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161b.iso / full / delphi / DELPHI16 / TECHINFO / DELPHI / TIS / TI2840.FX < prev    next >
Encoding:
Text File  |  1995-08-24  |  1.8 KB  |  122 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.   PRODUCT  :  Delphi                                 NUMBER  :  2840
  8.   VERSION  :  All
  9.        OS  :  Windows
  10.      DATE  :  July 27, 1995                            PAGE  :  1/2
  11.  
  12.     TITLE  :  Removing the vertical scrollbar from a TDBGrid
  13.  
  14.  
  15.  
  16.  
  17. In order to remove the vertical scrollbar from a TDBGrid component, 
  18. you must override its Paint method.  Inside the Paint method you 
  19. must call the SetScrollRange API procedure to set the min and max 
  20. scroll values to zero (this disables the scrollbar), and then call
  21. the inherited Paint.  The code below is a unit containing a new 
  22. component called TNoVertScrollDBGrid that does this.  You can copy
  23. the code into a file called NEWGRID.PAS, and add it to the component
  24. library as a custom component.
  25.  
  26.  
  27. unit Newgrid;
  28.  
  29. interface
  30.  
  31. uses
  32.   WinTypes, WinProcs, Classes, DBGrids;
  33.  
  34. type
  35.   TNoVertScrollDBGrid = class(TDBGrid)
  36.   protected
  37.     procedure Paint; override;
  38.   end;
  39.  
  40. procedure Register;
  41.  
  42. implementation
  43.  
  44. procedure TNoVertScrollDBGrid.Paint;
  45. begin
  46.   SetScrollRange(Self.Handle, SB_VERT, 0, 0, False);
  47.   inherited Paint;
  48. end;
  49.  
  50. procedure Register;
  51. begin
  52.   RegisterComponents('Data Controls', [TNoVertScrollDBGrid]);
  53. end;
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.   PRODUCT  :  Delphi                                 NUMBER  :  2840
  69.   VERSION  :  All
  70.        OS  :  Windows
  71.      DATE  :  July 27, 1995                            PAGE  :  2/2
  72.  
  73.     TITLE  :  Removing the vertical scrollbar from a TDBGrid
  74.  
  75.  
  76.  
  77.  
  78. end.
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118. DISCLAIMER: You have the right to use this technical information
  119. subject to the terms of the No-Nonsense License Statement that
  120. you received with the Borland product to which this information
  121. pertains.
  122.