Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is it possible to shift text created with Draw.TextFixed from edge of screen?

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

    Is it possible to shift text created with Draw.TextFixed from edge of screen?

    This may not be possible using Draw.TextFixed, but is it possible to shift an object created there n-spaces from the edge of the screen?

    I have one I have created via: "Draw.TextFixed(this,"myTextFixed", myTextString, TextPosition.TopRight, TextColorUp, myTextFont, Brushes.Transparent, Brushes.Transparent, 100);"

    Where the text string is stored in "myTextString"

    This places it in the top right corner, but if I wanted to shift it to the left a bit, is this possible?

    I have tried to add white spaces by concatenating a blank string to "MyTextString" by doing this:
    var displayText = Draw.TextFixed(this,"myTextFixed", (myTextString+" "), TextPosition.TopRight, TextColorDn, myTextFont, Brushes.Transparent, Brushes.Transparent, 100);

    This also does not work. I tried using the .PadRight(10) method, but this also does not work.

    Is this possible?

    #2
    Hello forrestang,

    Thanks for your post.

    You can try adding escape characters such as \t (tab) to the end of the line.

    I've done that in this example to provide a label and then a price after the label.

    Draw.TextFixed() was not intended to be used this way and for more precise control I would suggest using OnRender() directly but that is a lot of work if you only need a little display.

    Click image for larger version

Name:	DrawTextFixedColorExample.PNG
Views:	425
Size:	19.4 KB
ID:	1132699

    [ATTACH]n1132700[/ATTACH]

    You can do an internet search for additional c# escape characters.

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello forrestang,

      Thanks for your post.

      You can try adding escape characters such as \t (tab) to the end of the line.

      Thank you paul, this works perfectly for what I need. I wound up escaping with "\b".

      I REALLY need to learn how to use the SharpDK stuff!!!

      Comment


        #4
        Hello forrestang,

        Thanks for your reply.

        Glad you were able to find something that worked in this case.

        A somewhat easy entry into that other world would be looking at the indicator in your platform SampleCustomRender. It is well documented in the comments and you can make a copy and try adjusting things.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        63 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        91 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        48 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        105 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        63 views
        0 likes
        Last Post PaulMohn  
        Working...
        X