Minimum Origin Version Required: Origin 8 SR0
#include <..\Originlab\DialogEx.h> void OpenGraphPreviewDlg(bool bRealTimeUpdate = true) { GraphLayer gl = Project.ActiveLayer(); if( gl ) { // open preview dialog GraphPage gp = gl.GetPage(); GraphPreviewDlg dlgEx(gp, bRealTimeUpdate); dlgEx.DoModalEx( GetWindow() ); } } class GraphPreviewDlg : public ResizeDialog { public: GraphPreviewDlg(GraphPage& gp, bool bRealTimeUpdate, int ID = IDD_GETNBOX_PREVIEW); ~GraphPreviewDlg(); int DoModalEx(HWND hWndParent); protected: EVENTS_BEGIN ON_INIT(OnInitDialog) ON_BN_CLICKED(IDC_PARAMS_MORE, OnBtnClick) EVENTS_END BOOL OnInitDialog(); BOOL OnBtnClick(Control ctrl); private: void updatePreview(); private: GraphPage m_gpSource; PictureControl m_pictControl; bool m_bRealTimeUpdate; }; GraphPreviewDlg::GraphPreviewDlg(GraphPage& gp, bool bRealTimeUpdate, int ID) :ResizeDialog(ID, "ODlg") { m_gpSource = gp; m_bRealTimeUpdate = bRealTimeUpdate; } GraphPreviewDlg::~GraphPreviewDlg() { } BOOL GraphPreviewDlg::OnInitDialog() { ResizeDialog::OnInitDialog(); // to hidden ususeful controls vector<int> vnHiddenIDs = {IDC_ERR_MESSAGE_BOX, IDC_PARAMS_DESCRIPTION, IDC_GETN_RESULT_PREVIEW}; for(int nn = 0; nn < vnHiddenIDs.GetSize(); nn++) { Control ctrl = GetItem(vnHiddenIDs[nn]); if(ctrl) ctrl.Visible = false; } Control btn = GetItem(IDC_PARAMS_MORE); if( btn ) btn.Text = "UP"; Control cntrl = GetItem(IDC_PARAMS_PREVIEW); if(cntrl) m_pictControl.CreateControl(cntrl.GetSafeHwnd()); // this property to no stretch to enable scroll bar //m_pictControl.DrawMode = PCDM_NO_STRETCH; updatePreview(); return true; } void GraphPreviewDlg::updatePreview() { PictureHolder phDst; m_gpSource.GetPicture(phDst, "EMF", 72, -1, EMBEDGRAPH_HIDE_LEGENDS); m_pictControl.SetPicture(phDst); } BOOL GraphPreviewDlg::OnBtnClick(Control ctrl) { GraphLayer gl = m_gpSource.Layers(); // active layer DataPlot dp = gl.DataPlots(); // active data plot Curve crv(dp); crv += 1; // add 1 to each y data point, data plotting line will be moved up if( m_bRealTimeUpdate ) updatePreview(); return true; } int GraphPreviewDlg::DoModalEx(HWND hWndParent) { InitMsgMap(); DWORD dwDlgOptions = 0; int nRet = DoModal(hWndParent, dwDlgOptions); return nRet; }