Data Access Worldwide Knowledge Base
Article ID 2313 Article Title PROBLEM: Selecting Fonts for RichEdit sets sizes wrong Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2313 KBase Category VDF12 Date Created 05/23/2007 Last Edit Date 05/23/2007
Article Text
PROBLEM:
I use a (db)RichEdit control in my Visual DataFlex application. I want the user to be able to select a font. I use the standard FontDialog class to create an object for Font selection. When I do this, the size of the font in the RichEdit code is often wrong, especially when reporting via Crystal Reports. How do I fix this?
ANSWER:
The size of the font in a (db)RichEdit control is in twips (twentieth of a point, see http://en.wikipedia.org/wiki/Twips) for its size. The standard fontdialog uses points so there will be a mismatch.
Enclosed is a VDF 12.0 workspace that has a new cFontDialog class and a test program for you that fixes the problems. The new class uses structs and arrays for exchanging the data. You will need to make adjustments in your code since the property names are changed.
Contributed By:
Vincent Oorsprong
Company: Data Access Worldwide
email: vincent.oorsprong@dataaccess.eu
Web Site: http://www.dataaccess.eu
Web Links Related to this Article
File cFontDialog.zip
URL=http://www.dataaccess.com/KBasePublic/Files/2313.cFontDialog.zip
Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.
The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.