ROOT
6.18/05
Reference Guide
core
base
doc
macros
textalign.C
Go to the documentation of this file.
1
{
2
auto
*Ta =
new
TCanvas
(
"Ta"
,
"Ta"
,0,0,500,200);
3
Ta->Range(0,0,1,1);
4
5
auto
*
lv
=
new
TLine
;
6
lv
->SetLineStyle(3);
lv
->SetLineColor(
kBlue
);
7
lv
->DrawLine(0.33,0.0,0.33,1.0);
8
lv
->DrawLine(0.6,0.165,1.,0.165);
9
lv
->DrawLine(0.6,0.493,1.,0.493);
10
lv
->DrawLine(0.6,0.823,1.,0.823);
11
12
// Horizontal alignment.
13
auto
*
th1
=
new
TText
(0.33,0.165,
"Left adjusted"
);
14
th1
->SetTextAlign(11);
th1
->SetTextSize(0.12);
15
th1
->Draw();
16
17
auto
*
th2
=
new
TText
(0.33,0.493,
"Center adjusted"
);
18
th2
->SetTextAlign(21);
th2
->SetTextSize(0.12);
19
th2
->Draw();
20
21
auto
*
th3
=
new
TText
(0.33,0.823,
"Right adjusted"
);
22
th3
->SetTextAlign(31);
th3
->SetTextSize(0.12);
23
th3
->Draw();
24
25
// Vertical alignment.
26
auto
*
tv1
=
new
TText
(0.66,0.165,
"Bottom adjusted"
);
27
tv1
->SetTextAlign(11);
tv1
->SetTextSize(0.12);
28
tv1
->Draw();
29
30
auto
*
tv2
=
new
TText
(0.66,0.493,
"Center adjusted"
);
31
tv2
->SetTextAlign(12);
tv2
->SetTextSize(0.12);
32
tv2
->Draw();
33
34
auto
*
tv3
=
new
TText
(0.66,0.823,
"Top adjusted"
);
35
tv3
->SetTextAlign(13);
tv3
->SetTextSize(0.12);
36
tv3
->Draw();
37
}
kBlue
@ kBlue
Definition:
Rtypes.h:64
TCanvas
The Canvas class.
Definition:
TCanvas.h:31
TLine
A simple line.
Definition:
TLine.h:23
TText
Base class for several text objects.
Definition:
TText.h:23
th3
auto * th3
Definition:
textalign.C:21
tv3
auto * tv3
Definition:
textalign.C:34
th2
auto * th2
Definition:
textalign.C:17
tv1
auto * tv1
Definition:
textalign.C:26
lv
auto * lv
Definition:
textalign.C:5
tv2
auto * tv2
Definition:
textalign.C:30
th1
auto * th1
Definition:
textalign.C:13