Print Page | Close Window

How to query font used by ReportControl

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=24145
Printed Date: 23 April 2024 at 8:38am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to query font used by ReportControl
Posted By: wrecks
Subject: How to query font used by ReportControl
Date Posted: 31 March 2021 at 6:37pm
How can I query the font that is being used by a ReportControl?  

I know I can set the font by creating a StdFont object, setting its Name/Size/Weight and etc. properties, and then passing that font to PaintManager.TextFont.  

But how can I find out whatever the current font is?  (I like the font that RC is using -- I just want to know exactly what it is!)

What I really want to know is: how can I query the width (in pixels) of a text string when rendered in the current RC font?  If I can get a handle to the font, I know how to measure text size from there.

I am using Codejock.ReportControl.18.4.0

Thanks in advance for any help on this.



Replies:
Posted By: jpbro
Date Posted: 04 April 2021 at 11:16am
You should also be able to get the PaintManager.TextFont as an StdFont. 

In VB6 you can get the font like this:

Dim lo_Font As StdFont

Set lo_Font = Me.ReportControl1.PaintManager.TextFont  ' NOTE use of the Set keyword to get the font - this is required in VB6 to distinguish between object returning properties and non-object returning properties

I know you are using APL but I'm not sure if there's a similar way to get an object from a property (though I think there must be?)


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: wrecks
Date Posted: 04 April 2021 at 5:19pm
Yes, I can query PaintManager.TextFont, but if I use the pointer it returns to create an object, it does not have any properties.  

In your VB example, having created lo_Font, does it now have Name and Size properties?



Posted By: jpbro
Date Posted: 12 April 2021 at 8:02am
Sorry for the delay getting back to you! Yes, after getting the PaintManager.TextFont into lo_Font object all the properties are set as expected (Name, Font, Bold, etc...). Not sure why you wouldn't be getting that information? Maybe there's another way to turn assign the pointer to the StdFont object?


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net