Jump to content
Software FX Community

Bug? X axis not aligned with bottom of flat bars for Paint()


User (Legacy)

Recommended Posts

Hi,

I am using Cfx4032.dll ver 5.0.6.0 in a C++ application via

#import. When the chart is painted using Paint() method to

the given device context with wAction set to zero, the bottoms

of the flat bars are not aligned to the X-axis line (the line

is slightly moved up -- see the clipped part of the chart

in the attached PNG file). This was tested for CAS_NONE,

CAS_MATH, and CAS_FLATFRAME axes styles. The fragment of the

code below was rather simplified. The coordinates

recalculation and saving the DC is probably not important

for reconstruction of the behaviour.

Could you confirm the bug or explain the behaviour otherwise?

When needed, I can provide sources of a simple sample to

reconstruct the problem.

Thanks,

Petr

P.S. Notice also, that the yellow bar is not aligned with

the brown one ideally (see the attached picture) -- but this is

not that big visual problem.

The code fragment follows:

// Let hdc is a handle to DC where the chart should

// be painted. Let m_rc is the target rectangle in

// hundredths of milimeter.

// Recalculate dimensions of the target rectangle

// from hundredths of milimeters to points

// (1/72 of inch).

//

RECT rc = m_rc;

rc.left = MulDiv(rc.left, 72, 2540);

rc.top = MulDiv(rc.top, 72, 2540);

rc.right = MulDiv(rc.right, 72, 2540);

rc.bottom = MulDiv(rc.bottom, 72, 2540);

// Save the original DC, change the ratio, and paint.

//

if (::SaveDC(hdc))

{

// Change the logical coordinates to points.

//

::ScaleViewportExtEx(hdc, 2540, 72, 2540, 72, 0);

// Set the axes style to flat.

//

spChartFX->PutAxesStyle(CAS_FLATFRAME);

// Paint the chart.

//

spChartFX->Paint(reinterpret_cast<long>(hdc),

rc.left, rc.top,

rc.right, rc.bottom,

static_cast<enum ChartfxLib::CfxChartPaint>(0),

0);

::RestoreDC(hdc, -1);

}

--

Petr Prikryl (prikrylp at skil dot cz)

Link to comment
Share on other sites

I'm unable to reproduce this behavior, using your code produces a chart that

does not have this problem, I suspect you are later manipulating this DC and

therefore causing this object misplacement, is this DC a metafile ?

Increasing the size of a Metafile could cause this result as the objects are

moved as they are resized, this is a normal behavior of metafiles as

information is not complete in the original drawing. To prevent this create

a BIG metafile and re-size it down instead of up.

--

FP

Software FX, Inc.

Link to comment
Share on other sites

"SoftwareFX Support" wrote...

> I'm unable to reproduce this behavior, using your code produces a chart

that

> does not have this problem, I suspect you are later manipulating this DC

and

> therefore causing this object misplacement, is this DC a metafile ?

> [...]

Well, when I tried to write simplified version of the code, I could not

reproduce

it either. This DC is related to the screen or to the printer (no

metafile). But

I am doing some weird things with the chart. I have discovered that I have

to

clean-up the code a bit first. My apology for asking you before trying

harder

first. I will report the problems if they appear also after the cleaning up

the code.

Thanks,

Petr

--

Petr Prikryl (prikrylp at skil dot cz)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...