Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

RemoveDrawObject

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

    RemoveDrawObject

    I appreciate this might not be supported but if the answer is really simple perhaps you could point me in the right direction.

    In your custom plot sample you draw a string like so....

    Code:
    graphics.DrawString("Lower left corner", textFont, textBrush, bounds.X + 10, bounds.Y + bounds.Height - 20, stringFormat);
    As it has no tag how would I remove just that string ?
    RemoveDrawObject("") needs a tag?

    #2
    Originally posted by Mindset View Post
    I appreciate this might not be supported but if the answer is really simple perhaps you could point me in the right direction.

    In your custom plot sample you draw a string like so....

    Code:
    graphics.DrawString("Lower left corner", textFont, textBrush, bounds.X + 10, bounds.Y + bounds.Height - 20, stringFormat);
    As it has no tag how would I remove just that string ?
    RemoveDrawObject("") needs a tag?
    In this example, we are overriding the Plot() method. Each time this method is called its repainting that entire panel thus, there is no requirement to remove it. You would need to add logic in the Plot() method that would paint or not paint items you want.
    RayNinjaTrader Customer Service

    Comment


      #3
      Work around

      Thanks Ray - I realised that I could put an if... else String.empty in my logic and then check if the str has a value.
      That solved it.
      It would however be worthwhile to be able to tag each graphics object with a name - perhaps you could add that to your future development.

      Comment


        #4
        Originally posted by Mindset View Post
        Thanks Ray - I realised that I could put an if... else String.empty in my logic and then check if the str has a value.
        That solved it.
        It would however be worthwhile to be able to tag each graphics object with a name - perhaps you could add that to your future development.
        I am glad its resolved. At this level, you are programming purely against the graphics class in .NET and not at the NinjaScript layer. If you want tagged draw objects you would have to use NinjaScript methods.
        RayNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        152 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        89 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        133 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        127 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        107 views
        0 likes
        Last Post CarlTrading  
        Working...
        X