Jump to content
Software FX Community

Controlling the output size of a metafile?


User (Legacy)

Recommended Posts

ChartFX Client/server:

Is there a way that I can set the MAX size for a chart and it's series

legend? Even if I don't necessarily know the max width for the legend? For

example we have a project where the user can specify the maximum size that a

chart should take up when it is published. However when it has a legend

docked on the chart, the output size always exceeds the maximum( width in

this case with the legend docked on the right side ). This is how I output

the chart as a metafile:

HENHMETAFILE GetMetaFile()

{

if( chart_fx ){

HRESULT hr = chart_fx->CreateWnd( NULL, 0, 0, 0, size.cx, size.cy,

WS_POPUP );

if( SUCCEEDED( hr ) ){

chart_fx->UpdateSizeNow();

IPictureDisp *pic_disp = chart_fx->GetPicture( CHART_METAFILE );

if( pic_disp ){

CComPtr<IPicture> pict = NULL;

HRESULT hr = pic_disp->QueryInterface( IID_IPicture,

(void**)&pict );

if( SUCCEEDED( hr ) ){

HENHMETAFILE handle;

pict->get_Handle( (OLE_HANDLE*)&handle );

return handle;

}

}

}

}

return NULL;

}

Is there a way I can force the legend( if present ) to fit within the

maximum size, thereby making the chart area smaller?

-Mac

Link to comment
Share on other sites

The problem here is with the style you are passing to the window.

You can use either WS_OVERLAPPEDWINDOW (no parent) or WS_CHILD (you will

need to specify a parent). Either way you will get the desired results.

Note: If you create the window without an owner it will not be destroyed

until the application ends, chart object is freed or you call

DestroyWindow().

--

FP

Software FX, Inc.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...