Unit BSDBGrid |
================ BSDBGRID DISTRIBUTION NOTES ============================================} {BSDBGRID is a simple, but very effective TDBGRID descendant that can display each cell in the grid with either a raised, or lowered, 3-D appearance; in addition to the usual 'flat' appearance.} {COPYRIGHT NOTICE} {BSDBGRID is distributed as FREEWARE, but remains the COPYRIGHT of BUSINESS SOFTWARE (UK) (email ebinfo@compuserve.com ). Business Software grants you the right to include this compiled component in your DELPHI application, whether COMMERCIAL, SHAREWARE, or FREEWARE, BUT YOU MAY NOT DISTRIBUTE THIS SOURCE CODE OR ITS COMPILED .DCU IN ANY FORM OTHER THAN AS IT EXISTS HERE; COMPLETE WITH THIS NOTICE AND ALL THE TEXT BELOW. BSDBGRID may be included in any shareware or freeware libraries or compilation disks, provided no charge other than the usual media cost recovery is made.} {IF YOU HAVE ANY DOUBTS ABOUT WHETHER YOU MAY LEGALLY USE OR DISTRIBUTE THIS COMPONENT, CONTACT BUSINESS SOFTWARE BY E-MAIL.} {VISIT BUSINESS SOFTWARE'S WEB SITE AT HTTP://OURWORLD.COMPUSERVE.COM/HOMEPAGES/EBINFO/ for more interesting components and applications} {WARRANTY / ACCEPTANCE OF LIABILITY / INDEMNITY} {ABSOLUTELY NONE WHATSOEVER} {INSTALLATION} {1.Copy this file, and the *.DCR into your DELPHI/LIB directory, or wherever your library files are kept} {2.Select OPTIONS|INSTALL COMPONENTS|ADD...} {3.ADD This file; BSDBGRID.PAS to the INSTALLED UNITS listbox} {4.Click OK} {USING BSDBGRID} {In order to set the effects, a new PROPERTY 'Cellstyle', is published. Cellstyle may have one of three possible values: csNONE (default), csRAISED, and csLOWERED. Cellstyle may be set at design time, and will have a global effect on the Grid display, however, a much more interesting effect can be achieved if the property is altered dynamically at run time. For example; to LOWER any cells that contain a numerical value less than zero, and RAISE any cells with a value greater than 100, you would need to disable default drawing, and within the 'ondrawdatacell' event handler, add the code to raise or lower the cell. e.g. procedure Tform1.BSDBGrid1DrawDataCell(Sender:TObject;const Rect:TRect; Field:TField;State:TGridDrawState); const numbertypes=[ftcurrency,ftfloat,ftinteger,ftsmallint,ftbcd,ftword]; begin with bsdbgrid1 do begin cellstyle:=csnone; if (field.datatype in numbertypes) then begin if (field.asfloat<0) then Cellstyle:=csLowered; if (field.asfloat>100) then Cellstyle:=csRaised; end; {since default drawing is off, we still need to do the text drawing; you could make the most of it here by using different font colors for positives and negatives, and right-justifying numbers. But for this demo, here is the elementary way: Canvas.TextRect(Rect,Rect.left+2,Rect.Top+2,field.asString); end; end; {=============== END OF DISTRIBUTION NOTES ===================================================
Classes |
Functions |
Register -
Types |
Constants |
Variables |
Functions |
Types |
Tcellstyle=(csRaised,csLowered,csNone);
Constants |
Variables |