Jump to content
Software FX Community

Controlling the output size of a metafile?


User (Legacy)
 Share

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

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...