OnInternPaintPar

  • Guten Tag,
    I have been using the OnTextObjectPaint method to draw these nice looking rounded corner boxes that appear in the background with the text of the editor appearing on top of them.

    I would like to do the same thing with the OnInterPaintPar but anything I draw on the canvas appears in front of the editors text. Is there someway I can get item I draw on this canvas to appear behind the text? Either some variable to set or even re-working some code?

    Danke,
    Tim

  • Update

    I check the value of "Stage" and only draw when its equal to wpBeforeLineText but it is still drawing in front of the text.

    Here is the code within the InternPaintPar Event

    Code
    if Stage = wpBeforeLineText then
          begin
            Canvas.Pen.Color := $4d4dec;
            Canvas.Brush.Color := $c2c2eb;
            Canvas.RoundRect(LineData.x,Linedata.Y,Trunc(Par.TextAreaWidth / 1.95),Par.Height,30,30);
          end;
  • I know I could draw just the outline and set the ParColorOverride to the color I want, but I need to have the rounded corners that the roundrect function provides.

    So its imperative that I am able to draw anything behind the text.

    Danke,
    Tim

  • I am on my way to figuring it out.

    I did not know that it was calling this per line and the multiple draws I made each time covered more than the area that just the line being drawn (since each draw started at the top of the paragraph) and this caused it to overwrite the text.

    • Offizieller Beitrag

    Hello,

    Your parameters to RoundRect are not correct since RoundRect is expecting X1,Y1,X2,Y2.

    You can use code like this: