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 CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        53 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        35 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        103 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        182 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        171 views
        0 likes
        Last Post CarlTrading  
        Working...
        X