Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - How to query font used by ReportControl
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to query font used by ReportControl

 Post Reply Post Reply
Author
Message
wrecks View Drop Down
Groupie
Groupie


Joined: 14 July 2015
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote wrecks Quote  Post ReplyReply Direct Link To This Post Topic: How to query font used by ReportControl
    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.
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
wrecks View Drop Down
Groupie
Groupie


Joined: 14 July 2015
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote wrecks Quote  Post ReplyReply Direct Link To This Post 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?

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.