ROHLFS Reiner wrote: > Hi ROOTers, > > I want to draw the labels of the axis always in the same size in pixels units > independent of the size of the pad. > > My idea to do this is to get notified from ROOT every time the pad is resized. > Now I could recalculate the size of the labels if the function TPad::YtoPixel() > already calculates with the new size of the pad. > > Is there a virtual function of TPad that I can use to recalculate the size of > the labels? > And is the new size of the pad already set while this function is called from > ROOT? > > I assume ExecuteEvent is only called at a mouse event but not at a resize > event. You can use a combination of the following TPad functions: GetWh(); returns canvas size in pixels GetAbsHNDC(); returns relative size (in Y) of this pad in canvas ==> size of pad in pixels = pad->GetWh()*pad->GetAbsHNDC() Now, text sizes are always expressed as a fraction of the pad size. If you want your text size to be (say 18 pixels in Y), float textsize = 18/(pad->GetWh()*pad->GetAbsHNDC()); To set the Y axis label sizes, you can do; TAxis *yaxis = hist->GetYaxis(); yaxis->SetLabelSize(textsize); Currently, no user functions can be called when a pad is resized. I remember discussing this possibility some time ago !! Rene Brun
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:22 MET