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:	222
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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        94 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        51 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        80 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        75 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        62 views
        0 likes
        Last Post CarlTrading  
        Working...
        X