Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How I can get width and height of Text?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How I can get width and height of Text?

    Hello.
    I draw text with RenderTarget.DrawText method. How I can get width and height of Text to Draw in pixels?
    Click image for larger version

Name:	DrawText.png
Views:	220
Size:	50.4 KB
ID:	1197986
    RenderTarget.DrawText(key.Value.Time.ToString(), footPrintBarTextFormat,
    new RectangleF(CenterPoint.X - 150.0f, CenterPoint.Y + Radius, 300.0f, fontOffset), ClusterColor.ToDxBrush(RenderTarget));
    Thank you.


    #2
    Hi _Roman, thanks for posting. There is nothing that exist by default in the NInjaScript library. I found this question asked on the same subject that has some things you can look into:

    https://stackoverflow.com/questions/...iven-character (publicly available).

    Kind regards,
    -ChrisL

    Comment


      #3
      Originally posted by NinjaTrader_ChrisL View Post
      Hi _Roman, thanks for posting. There is nothing that exist by default in the NInjaScript library. I found this question asked on the same subject that has some things you can look into:

      https://stackoverflow.com/questions/...iven-character (publicly available).

      Kind regards,
      -ChrisL
      Thank you very much ChrisL.

      Comment


        #4
        layout.Metrics.Width will give you the width of your text layout

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        683 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        386 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        111 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        584 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        585 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X