Jump to content
Software FX Community

Set axis format in VC++ MFC


User (Legacy)

Recommended Posts

Dear Support People,

I want to set the x-axis format to "AF_SCIENTIFIC" in my VC++/MFC project

with #import drective.

The code i wrote is:

m_pChartFX->Axis->Item[AXIS_X]->Format = AF_SCIENTIFIC;

But i got a compile error:

error C2664: 'PutFormat': cannot conver parameter 1 from 'enum CfxFormat' to

'const class _variant_t &'

What should i do? What is correct syntax for setting the format?

Thanks!

Li He

Link to comment
Share on other sites

The Axis.Format property is declared as a variant so that you can pass both 

predefined formats and custom strings. To use AF_SCIENTIFIC (or any of the

prededfined formats) your code should look like

VARIANT v;

V_VT(&v) = VT_I4;

V_I4(&v) = AF_SCIENTIFIC;

m_pChartFX->Axis->Item[AXIS_X]->Format = v;

Note that you could also use one of the MFC/ATL wrappers around variant but

in the case of an integer there is nothing to cleanup.

--

Regards,

JC

Software FX Support

"Li He" <lhe@ultra-scan.com> wrote in message

news:fv5A0rFuEHA.3620@webserver3.softwarefx.com...

> Dear Support People,

>

> I want to set the x-axis format to "AF_SCIENTIFIC" in my VC++/MFC project

> with #import drective.

>

> The code i wrote is:

>

> m_pChartFX->Axis->Item[AXIS_X]->Format = AF_SCIENTIFIC;

>

> But i got a compile error:

> error C2664: 'PutFormat': cannot conver parameter 1 from 'enum CfxFormat'

> to

> 'const class _variant_t &'

>

> What should i do? What is correct syntax for setting the format?

>

> Thanks!

> Li He

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...