ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Resizing viewer
Posted by Olivier on Oct-02-2018 04:04
Attachments:
Hello,

I am currently evaluating the code with the hello world example project to get a feel of the code and i was trying to modify the size of the chart to make it bigger with the following lines in the helloworldDlg.cpp file:

// Create a XYChart object of size 250 x 250 pixels
    XYChart *c = new XYChart(250*2, 250*2);

// Set the plot area at (30, 20) and of size 200 x 200 pixels
    c->setPlotArea(30, 20, 200*2, 200*2);

but when i do, the plot & the chart resizes as desired but the window stays the same and it cuts the chart.

I understand that the c pointer is the chart object but it seems to be independent of the application window.

My question is the following :

Is there an easy way to change the application window's size ?

It is the first time that i touch to plotting and charts so it may be a newbie question.

I know it can be done since other projects have different window size but I have searched the code of the helloworld project and haven't found any line that seems to determine a fixed size. The chm file doesn't seem to talk about it either. I searched the forum too and the questions asked are too specific. I just want to be able to see what i do. Some guidance would be appreciated.

Thank you

Olivier
Capture.JPG

  Re: Resizing viewer
Posted by Peter Kwan on Oct-02-2018 23:40
Hi Olivier,

In MFC, when you resize a control, only the control is resized. The containing window is not resized. This is the same for all standard MFC controls.

For the Hello World sample code (as well as most of the MFC sample code included in the ChartDirector download), the default window size is just the window size set in the dialog editor. You can freely modify the control size in the dialog editor.

If you want to programmatically control the window size, please use the MFC CWnd::SetWindowPos. See:

https://msdn.microsoft.com/en-us/library/a1yzfz6d.aspx?f=255&MSPPError=-2147217396

For example:

SetWindowPos(NULL, -1, -1, c->getWidth() + 40, c->getHeight() + 70, SWP_NOMOVE);

Hope this can help.

Regards
Peter Kwan

  Re: Resizing viewer
Posted by Olivier on Oct-03-2018 00:47
Thank you for your answer!