@@ -112,9 +112,10 @@ of the canvas. It gives a short explanation about the canvas' menus.
112112A canvas may be automatically divided into pads via `TPad::Divide`.
113113
114114At creation time, no matter if in interactive or batch mode, the constructor
115- defines the size of the canvas window (including the size of the window
116- manager's decoration). To define precisely the graphics area size of a canvas in
117- the interactive mode, the following four lines of code should be used:
115+ defines the size of the canvas window (including the size of the ROOT menu bar but
116+ excluding the size of the OS window manager's decoration). To define precisely the
117+ graphics area size of a canvas in batch/interactive mode, the following code should
118+ be used:
118119~~~ {.cpp}
119120 {
120121 Double_t w = 600;
@@ -123,9 +124,18 @@ the interactive mode, the following four lines of code should be used:
123124 c->SetWindowSize(w + (w - c->GetWw()), h + (h - c->GetWh()));
124125 }
125126~~~
126- and in the batch mode simply do:
127+
128+ To ensure similar painting size for the canvas created with default size for both interactive and batch mode:
129+ ~~~ {.cpp}
130+ {
131+ auto c = new TCanvas("c", "c");
132+ c->SetWindowSize(c->GetWindowWidth() + (c->GetWindowWidth() - c->GetWw()), c->GetWindowHeight() + (c->GetWindowHeight() - c->GetWh()));
133+ }
134+ ~~~
135+
136+ If you are in batch mode, you can also specify the fixed painting area as follows:
127137~~~ {.cpp}
128- c->SetCanvasSize(w,h);
138+ c->SetCanvasSize(w, h);
129139~~~
130140
131141If 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)
19401950// / are greater than the current canvas window a scroll bar is automatically
19411951// / generated. Use this function to zoom in a canvas and navigate via
19421952// / the scroll bars. The Width and Height in this method are different from those
1943- // / given in the TCanvas constructors where these two dimension include the size
1944- // / of the window decoration whereas they do not in this method.
1953+ // / given in the TCanvas constructors where these two dimensions include the size
1954+ // / of the ROOT canvas menubar decoration whereas they do not in this method.
19451955// / When both ww==0 and wh==0, auto resize mode will be enabled again and
19461956// / canvas drawing area will automatically fit available window size
19471957
0 commit comments