Logo ROOT   6.10/09
Reference Guide
textalign.C
Go to the documentation of this file.
1 {
2  TCanvas *Ta = new TCanvas("Ta","Ta",0,0,500,200);
3  Ta->Range(0,0,1,1);
4 
5  TLine *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  TText *th1 = new TText(0.33,0.165,"Left adjusted");
14  th1->SetTextAlign(11); th1->SetTextSize(0.12);
15  th1->Draw();
16 
17  TText *th2 = new TText(0.33,0.493,"Center adjusted");
18  th2->SetTextAlign(21); th2->SetTextSize(0.12);
19  th2->Draw();
20 
21  TText *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  TText *tv1 = new TText(0.66,0.165,"Bottom adjusted");
27  tv1->SetTextAlign(11); tv1->SetTextSize(0.12);
28  tv1->Draw();
29 
30  TText *tv2 = new TText(0.66,0.493,"Center adjusted");
31  tv2->SetTextAlign(12); tv2->SetTextSize(0.12);
32  tv2->Draw();
33 
34  TText *tv3 = new TText(0.66,0.823,"Top adjusted");
35  tv3->SetTextAlign(13); tv3->SetTextSize(0.12);
36  tv3->Draw();
37 
38  return Ta;
39 }
TText * th3
Definition: textalign.C:21
virtual TLine * DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
Definition: TLine.cxx:93
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:202
TText * th2
Definition: textalign.C:17
Base class for several text objects.
Definition: TText.h:23
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition: TAttText.h:41
TText * th1
Definition: textalign.C:13
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
TText * tv1
Definition: textalign.C:26
virtual void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Set world coordinate system for the pad.
Definition: TPad.cxx:5085
A simple line.
Definition: TLine.h:23
TText * tv2
Definition: textalign.C:30
The Canvas class.
Definition: TCanvas.h:31
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition: TAttLine.h:42
TLine * lv
Definition: textalign.C:5
return Ta
Definition: textalign.C:38
TText * tv3
Definition: textalign.C:34
Definition: Rtypes.h:56
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition: TAttText.h:46