delphi - TMetaFileCanvas and DrawTextEx with DT_RIGHT flag and Arial font -


my program must use tmetafile objects draw text on timage. call system function "drawtextex".

when assign "arial" font , right alignment (flag dt_right) text truncated @ end if string contains lots of "1" chars (i.e.: "111111111111111112" string).

enter image description here

the white square far smaller timage canvas.

i've posted question topic answer didn't work tmetafile.

following code reproduce issue:

procedure tform2.test2click(sender: tobject); var    rc: trect;   s : string;   oldbrushcolor: tcolor;   oldbrushstyle: tbrushstyle;   metacanvas: tmetafilecanvas; begin   // in example, image1 size w:585, h:225   metacanvas := tmetafilecanvas.create(image1.picture.metafile, 0);    rc := rect(10, 10, 200, 200);    oldbrushcolor :=  metacanvas.brush.color;   oldbrushstyle := metacanvas.brush.style;    metacanvas.brush.color := clwhite;   metacanvas.brush.style := bssolid;    metacanvas.rectangle(rc.left, rc.top, rc.right, rc.bottom);    metacanvas.brush.color := oldbrushcolor;   metacanvas.brush.style := oldbrushstyle;   metacanvas.font.name := 'arial';    metacanvas.font.height := 14;   metacanvas.brush.color := clwhite;   metacanvas.brush.style := bsclear;   s := '111111111111111112';     drawtextex(     metacanvas.handle,     pchar(s),     length(s),     rc,     dt_right,     nil);    metacanvas.free; end; 

the problem verified on windows 7 , greater. tested delphi 2007 , xe3 version.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -