| View previous topic :: View next topic |
| Author |
Message |
sang tan Guest
|
Posted: Thu Jan 26, 2006 10:37 am Post subject: How to get the width of text in QReport? |
|
|
I created a dynamic qreport for auto-generating the fields. The label's
caption is based on the data field's DisplayLabel property. I use the
Canvas.TextWidth function to get the width of text. But it cannot get
the correct Textwidth. Does anyone know how to solve it?
coding:
with TQRLabel.Create(nil) do
begin
Parent := aHdrBand;
Name := 'qrlH'+ aField.FieldName;
AutoSize := False;
WordWrap := False;
Caption := aField.DisplayLabel;
Top := ct_iTop;
Left := aPos;
Font := aHdrBand.Font;
Font.Style := [fsUnderline];
iHrdWidth := Canvas.TextWidth(aField.DisplayLabel);
Width := iHrdWidth;
Thanks |
|
| Back to top |
|
 |
sang tan Guest
|
Posted: Thu Jan 26, 2006 11:47 am Post subject: Re: How to get the width of text in QReport? |
|
|
The problem is solved. thank all.
sang tan wrote:
| Quote: | I created a dynamic qreport for auto-generating the fields. The label's
caption is based on the data field's DisplayLabel property. I use the
Canvas.TextWidth function to get the width of text. But it cannot get
the correct Textwidth. Does anyone know how to solve it?
coding:
with TQRLabel.Create(nil) do
begin
Parent := aHdrBand;
Name := 'qrlH'+ aField.FieldName;
AutoSize := False;
WordWrap := False;
Caption := aField.DisplayLabel;
Top := ct_iTop;
Left := aPos;
Font := aHdrBand.Font;
Font.Style := [fsUnderline];
iHrdWidth := Canvas.TextWidth(aField.DisplayLabel);
Width := iHrdWidth;
Thanks |
|
|
| Back to top |
|
 |
|