<< Return to Main Index

< Return to Class Index

class CGXDrawingAndFormatting

CGXDrawingAndFormatting encapsulates some general methods used for drawing and formatting text in the grid. In earlier versions these methods were global methods. The disadvantage was that there was no possibility for you to customize these methods without modifying the source code.

The CGXDrawingAndFormatting class gives you now the possibility to override the default behavior of these methods.

If you have derived a class from CGXDrawingAndFormatting you can force Objective Grid to use your customized methods by calling SetDaFTools.

Example:

class CMyDrawingTools: public CGXDrawingAndFormatting
{
public:
   CMyDrawingTools();

   virtual CString GXFormatText(const CGXStyle& style, LPCTSTR pszValue = NULL, unsigned nValueType = GX_VT_STRING, CGXGridCore* pGrid = NULL, CGXControl* pControl = NULL);
};


// in your InitInstance method

   GXInit();
   GXSetDaFTools(new CMyDrawingTools);

whereas CMyDrawingTools must be derived from CGXDrawingAndFormatting

The following methods that are documented in "MacrosAndGlobals" can be overriden with this class:

// Text routines
virtual int  GXDrawTextLikeMultiLineEdit(CDC* pDC, LPCTSTR lpszString, int nCount, CRect rect, UINT nFormat, LPRECT lpRectClip = NULL);

virtual int  GXDrawRotatedText(CDC* pDC, LPCTSTR lpszString, int nCount, CRect rect, UINT nFormat, LONG lfOrientation, LPRECT lpRectClip = NULL);

virtual int  GXGetMultiLineTextPosUnderPt(CDC* pDC, LPCTSTR lpszString, int nCount, CRect rect, UINT nFormat, CPoint pt);

virtual int  GXGetMultiLineTextBreakCount(CDC* pDC, LPCTSTR lpszString, int nCount, CRect rc, UINT nFormat);

virtual int  GXComputeLineBreaks(CDC* pDC, LPCTSTR sz, int nCount, LPRECT rc, UINT nFormat, int* LineBreaks, int* LineLengths, int nMaxBreaks);

// Text formatting and parsing
virtual CString GXFormatText(const CGXStyle& style, LPCTSTR pszValue = NULL, unsigned nValueType = GX_VT_STRING, CGXGridCore* pGrid = NULL, CGXControl* pControl = NULL);

virtual BOOL GXDeval(LPCTSTR s, double *d, unsigned* pImportFormat = NULL, unsigned* pImportPlaces = NULL);

See "MacrosAndGlobals" reference for description of these methods.

See Also

GXDrawTextLikeMultiLineEdit GXDrawRotatedText GXGetMultiLineTextPosUnderPt GXGetMultiLineTextBreakCount GXComputeLineBreaks GXFormatText GXDeval

CGXDrawingAndFormatting

Class Members