Forum > Win32/64

graphics textrect problem.

(1/2) > >>

powerpcer:
it shows so randomly,
i use a loop to render text using textrect.
but it give me strange behavior.
it will randomly render text like attachment in red rectangle,
the bottom line of pixel of text will render opaque.
it only happen in ASCII character

wp:
Please post the code that you use for painting this.

powerpcer:
 workingDC is a canvas of TBitmap


 FFontSize.cx := ceil(workingDC.TextWidth('體') / 2);
  FFontSize.cy := workingDC.TextHeight('體');
loop
      r.Top:= r.Top+ FFontSize.cy ;
      r.Bottom:= r.Bottom+ FFontSize.cy;
....
....
TextStyle := workingDC.TextStyle;
TextStyle.Wordbreak := False;
workingDC.Brush.Color := AnsiColorTable[ gc ];
workingDC.FillRect(r);
workingDC.font.Color := AnsiColorTable[ fc ];
workingDC.TextRect(r,r.Left,r.Top, s,TextStyle);

wp:
No, I don't want to play with pasted incomplete code snippets where I can make too many things different from you. What I need is a simple, compilable project which definitely shows the issue and which I can look at. Pack the .pas, .lfm, .lpi and .lpr files into a common .zip which you can upload via "Attachments and other options" below the forum edit box. Do not include the exe and other compiler generated files.

powerpcer:
ok, i found the problem is when i redraw it use stretchdraw().

Navigation

[0] Message Index

[#] Next page

Go to full version