ROOT  6.06/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 }
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:254
Base class for several text objects.
Definition: TText.h:42
virtual void SetTextAlign(Short_t align=11)
Definition: TAttText.h:55
virtual void SetLineColor(Color_t lcolor)
Definition: TAttLine.h:54
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:4627
A simple line.
Definition: TLine.h:41
The Canvas class.
Definition: TCanvas.h:48
virtual void SetLineStyle(Style_t lstyle)
Definition: TAttLine.h:56
TCanvas * Ta
Definition: textalign.C:2
Definition: Rtypes.h:61
virtual void SetTextSize(Float_t tsize=1)
Definition: TAttText.h:60