Setting Font for TChart Header

TeeChart for ActiveX, COM and ASP
Post Reply
nbp
Newbie
Newbie
Posts: 83
Joined: Mon Sep 18, 2006 12:00 am

Setting Font for TChart Header

Post by nbp » Wed Sep 17, 2008 4:59 pm

I need to set the Font for the header but can't find a SetFont Property for CTitles. I have the following

e.g.

LOGFONT mlf;
mChart->GetHeader().SetFont(mLf)


does not work (there is no SetFont method for CTitles)

Can someone point me in the right direction?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Sep 18, 2008 10:07 am

Hi nbp,

You need to use GetFont().SetName method as in the example I posted here.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

nbp
Newbie
Newbie
Posts: 83
Joined: Mon Sep 18, 2006 12:00 am

Post by nbp » Fri Feb 13, 2009 8:44 pm

Thanks. SetName() worked for me. Now I want to set the size of the font using the size I get from a CFontDialog but the text on the Chart is very big. I'm using

CFontDialog dlg;
dlg.doModal();


m_Chart->GetHeader().GetFont().SetSize( dlg.GetSize());

I also tried setting the height using the size as follows:

long newSize = m_Chart->GetHeader().GetFont().GetSize() * m_Chart->GetHeader.GetFont().GetPixelsPerInch/72;

m_Chart->GetHeader().GetFont().SetHeight(newSize);

This also produced much larger text than expected...

What property should I be setting?

Thanks

nbp
Newbie
Newbie
Posts: 83
Joined: Mon Sep 18, 2006 12:00 am

Post by nbp » Fri Feb 13, 2009 9:12 pm

Another related question:

How do I initialize a CFontDialog object (MFC) with properties of the Chart Header? Is there an example I can view?

Thanks.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Mon Feb 16, 2009 11:50 am

Hi nbp,

Here is an example of how you could set the chart's header font size to be shown at the editor:

Code: Select all

	LOGFONT lf;
	memset(&lf, 0, sizeof(LOGFONT));

	CClientDC dc(this);
	lf.lfHeight = -MulDiv(m_Chart1.GetHeader().GetFont().GetSize(), dc.GetDeviceCaps(LOGPIXELSY), 72);

	CFontDialog fdlg(&lf);
    fdlg.DoModal();
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply