How to embed a TCanvas or ROOT-based widget into window Form in visual studio 2011?

Hi,
I would like to add some ROOT-based GUI windows into window application (standard Form) of vs 2011,
how to do that ? Thanks for your nice suggestions.

@bellenot can surely gives you good hints about this.

https://root.cern.ch/how/how-embed-tcanvas-external-applications

Thanks. good hints.
I followed instructions and test successfully.
However, it not easy.


The histogram can not be shown, and the canvas can’t be moved to the position I wanted.
//in c++, this represent current window
int wid = gVirtualX->AddWindow((ULong_t)this->Handle.ToInt64(), 300, 200);
gVirtualX->MoveWindow(wid, 600,400);
// Create a new TCanvas, specifying this window’s id as parent
fCanvas = new TCanvas(“fCanvas”, 300, 200, wid);

could you please share me with some step-by-step manual or some demo ?

The link is the most detailed description I have. But I’ll try to find some (very) old code and will add it here soon

Here is an old project. You might have to change some of the settings (e.g. it’s using (ROOTSYS)/include for the include path and (ROOTSYS)/lib for the library path). I just tried it and it works just fine.
MFCMDIRoot.tar.gz (117.4 KB)

Cheers, Bertrand.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.