Jump to content

проблема с MeasureText или FillText?


s.fedotenko@gmail.com

Recommended Posts

Добрый день.

при выводе текста на канву

...

	pCanvas.FillColor(TAlphaColorRec.White);
    pCanvas.Stroke.Kind := TfgBrushKind.Solid;
    pCanvas.Stroke.Color := TAlphaColorRec.Green;
    pCanvas.Stroke.Thickness := 1;

    pCanvas.Fill.Kind := TfgBrushKind.Solid;
    pCanvas.Fill.Color := TAlphaColorRec.Blue;

    pCanvas.Font.Size := 40;
    sss := 'Hello';
    TextSize := pCanvas.MeasureText(sss, TSizeF.Create(1000, 1000), false);

    R := rectf((pCanvas.Width / 2) - TextSize.cx / 2, (pCanvas.Height / 2) - TextSize.cy / 2,
               (pCanvas.Width / 2) + TextSize.cx / 2, (pCanvas.Height / 2) + TextSize.cy / 2);

    pCanvas.DrawRect(R);
    pCanvas.FillText(R, sss, false, TfgHorizontalAlignment.Center, TfgVerticalAlignment.Center);
...

получаем:

 

image.png.c02c30c6e0219dabfa40ca0c181b34be.png

 

 

 

fgx 1.9.1.0

delphi xe 10.4.1

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...