diff --git a/graf2d/gpad/src/TCanvas.cxx b/graf2d/gpad/src/TCanvas.cxx index be3908b3b363e..02f318e4a2f30 100644 --- a/graf2d/gpad/src/TCanvas.cxx +++ b/graf2d/gpad/src/TCanvas.cxx @@ -112,9 +112,10 @@ of the canvas. It gives a short explanation about the canvas' menus. A canvas may be automatically divided into pads via `TPad::Divide`. At creation time, no matter if in interactive or batch mode, the constructor -defines the size of the canvas window (including the size of the window -manager's decoration). To define precisely the graphics area size of a canvas in -the interactive mode, the following four lines of code should be used: +defines the size of the canvas window (including the size of the ROOT menu bar but +excluding the size of the OS window manager's decoration). To define precisely the +graphics area size of a canvas in batch/interactive mode, the following code should +be used: ~~~ {.cpp} { Double_t w = 600; @@ -123,9 +124,18 @@ the interactive mode, the following four lines of code should be used: c->SetWindowSize(w + (w - c->GetWw()), h + (h - c->GetWh())); } ~~~ -and in the batch mode simply do: + +To ensure similar painting size for the canvas created with default size for both interactive and batch mode: +~~~ {.cpp} + { + auto c = new TCanvas("c", "c"); + c->SetWindowSize(c->GetWindowWidth() + (c->GetWindowWidth() - c->GetWw()), c->GetWindowHeight() + (c->GetWindowHeight() - c->GetWh())); + } +~~~ + +If you are in batch mode, you can also specify the fixed painting area as follows: ~~~ {.cpp} - c->SetCanvasSize(w,h); + c->SetCanvasSize(w, h); ~~~ If the canvas size exceeds the window size, scroll bars will be added to the canvas @@ -1940,8 +1950,8 @@ void TCanvas::SetBatch(Bool_t batch) /// are greater than the current canvas window a scroll bar is automatically /// generated. Use this function to zoom in a canvas and navigate via /// the scroll bars. The Width and Height in this method are different from those -/// given in the TCanvas constructors where these two dimension include the size -/// of the window decoration whereas they do not in this method. +/// given in the TCanvas constructors where these two dimensions include the size +/// of the ROOT canvas menubar decoration whereas they do not in this method. /// When both ww==0 and wh==0, auto resize mode will be enabled again and /// canvas drawing area will automatically fit available window size