Jump to content
Software FX Community

Set axis format in VC++ MFC


User (Legacy)
 Share

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...