TPaveText *mytext = new TPaveText(0.1, 0.1, 0.9, 0.9); mytext->SetLineColor(kBlue); // sets the frame color to blue mytext->Draw();
TCanvas *canvas = new TCanvas("canvas", "My Canvas"); TPaveText *mytext = new TPaveText(0.1, 0.1, 0.9, 0.9); mytext->SetLineColor(canvas->GetFrame()->GetLineColor()); // sets the frame color to the color of the canvas frame mytext->Draw();In this example, a TCanvas object is created with the name "canvas". A TPaveText object is then created with coordinates (0.1, 0.1) to (0.9, 0.9) on the canvas. The SetLineColor function is called with the GetLineColor function of the canvas's frame to set the frame color of the text box to the same color as the canvas's frame. Finally, the text box is drawn on the canvas. Package Library: ROOT (The ROOT class library provides a set of C++ classes for building high-energy physics analysis applications.)