• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2327
  • Last Modified:

QuickReport qrShape dynamic height

Hi,
I Have an autostretch qrdbText and a qrShape (Vertical line) in a
detailband.
I trying when detailband is stretched the qrshape.height =
qrdetailband.height but I can't do this
Do you have any Idea???
0
jhkrs
Asked:
jhkrs
  • 5
  • 2
1 Solution
 
pcsentinelCommented:
Have you put that code int the  onBeforePrint of the band?

Or try putting it on the onprint of the qrdbtext

regards
0
 
pcsentinelCommented:
I've just tried it quickly with a qrdbtext

and in the onprint I added

qrshape1.height:=qrlabel1.Height;

on preview the shape height is adjusted


hope this helps

regards
0
 
pcsentinelCommented:
Sorry doesn't work,

get back to you
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
pcsentinelCommented:
Ok this works

on the Onprint method of your qrdbtext do this

var
  lFlags: Longint;
  lRect: TRect;
begin
  lRect.Left:=0;
  lRect.Top:=0;
  lRect.Right:=QRLabel1.width;
  lRect.Bottom:=QRLabel1.Height;
  lFlags:=DT_CALCRECT+DT_LEFT+DT_NOPREFIX+DT_WORDBREAK;
  DrawText(Canvas.Handle, pChar(QRLabel1.Caption), Length(QRLabel1.Caption), lRect, lFlags);
      qrshape1.height:=lRect.Bottom-lRect.Top;
end;


regards
0
 
jhkrsAuthor Commented:
Thanks to u I am too close.
Thx thx Thx.
but the shape doesn't reach the bottom of detail band.
Can u give me more info about :
   lFlags:=DT_CALCRECT+DT_LEFT+DT_NOPREFIX+DT_WORDBREAK



0
 
jhkrsAuthor Commented:
Also When u say QRLabel1 u mean qrdbtext ????
0
 
pcsentinelCommented:
re Also When u say QRLabel1 u mean qrdbtext  - yes

its just then when i tested it I just a label rather than a text

lFlags:=DT_CALCRECT+DT_LEFT+DT_NOPREFIX+DT_WORDBREAK

there are 2 taht are important here calcrect modifies the pst in lRect so that it measures the height of the text and wordbreak allows for multiple lines.

the difference may be font related as it uses the font of the canvas (i.e.) the form canvas. if your quickreport uses a different font then you need to do

  lFlags:=DT_CALCRECT+DT_LEFT+DT_NOPREFIX+DT_WORDBREAK+DT_EDITCONTROL;
  DrawText(QuickRep1.Printer.Canvas.Handle, pChar(QRLabel1.Caption), Length(QRLabel1.Caption), lRect, lFlags);

Also note I have added DT_EDITCONTROL this handles the sizing slightly differently.

You may also need to add things like qrdbtext.top to the calculation

regards
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now