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 argusthome, Yesterday, 10:06 AM
        0 responses
        14 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        11 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        9 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        4 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        31 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X