Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtPPVW custom font during print / print preview and __EGCS_EX_AUTO_BEST_FIT Collapse All
Subject Author Date
Piotr Tracz Feb 21, 2011 - 5:19 AM


ProfUIS 2.91.  I have derived class from CExtPPVW <CExtGridWnd> with __EGCS_EX_AUTO_BEST_FIT set for every. In grid inicialization function there is line BestFitColumns( 0L, -1L, 0, true, true, false, true); so everything works perfect. I want change font size during print / print preview of my CExtPPVW <CExtGridWnd> derived grid. Font change is done vie overriding virtual void OnPrepareDC(CDC * pDC,CPrintInfo *pInfo = NULL). The problem is that after changing font column’s width is not recalculated. I guess I need to invoke BestFitColumns somewhere after OnPrepareDC but not sure where and when. I guess BestFitColumns should be also again  invoked after closing print preview or after printing to make normal "view" well fitted. What is the bes solution to make __EGCS_EX_AUTO_BEST_FIT working in that case.

Technical Support Feb 21, 2011 - 11:46 AM

The printing/previewing subsystem is completely independent from the grid control. Please override the CExtGridCell::OnQueryCellFont() or CExtGridWnd::OnGridCellQueryFont() virtual methods to provide particular grid cells with custom font. These methods have the dwHelperPaintFlags parameter which will contain the __EGCPF_PRINTING_TARGET_MASK flags in case of printing.