2010-01-22 42 views
3

我正在使用Delphi 7和Rave Reports。 如何根據之前提供的另一個DataText的大小設置DataText.Left屬性(來自Rave Reports)dinamicaly。 我嘗試使用從前面的DataText的寬度,第一個DataText正在顯示的字段的長度......他們都沒有工作。 我真的很感激,如果有人可以給我任何想法。Rave Reports DataText Left

由於

回答

0

長度不採取字符的寬度考慮進去,這將取決於字體設置而變化。

// Assumes the AutoSize property is true. 
// Note: 8 is added as spacing 
DataText.Left := LastDataText.Left + LastDataText.Width + 8; 

如果裝載從數據集的數據,看看在TField類的DisplayWidth財產。

// calculate the width of the last field. 
TextWidth := DataSet.Fields[0].DisplayWidth * QuickReport.Canvas.TextWidth('M'); 
DataText.Left := LastDataText.Left + TextWidth; 
+0

我沒有測試上面的代碼。我需要檢查* QuickReport.Canvas *是否正確。 – stukelly 2010-02-06 01:30:35

0

或者,取決於你所需要的確切效果,你也可以只使用一個datatext,並連接數據/靜態文本字段是這樣的:

<FieldName> + ' Some text ' + <Param.ParamName> + ' Some other text'