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:	227
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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        57 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        78 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        39 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        101 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        61 views
        0 likes
        Last Post PaulMohn  
        Working...
        X