Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

DIfference between OnRender and OnRenderTargetChange

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

    DIfference between OnRender and OnRenderTargetChange

    in the example: https://ninjatrader.com/support/help...getchanged.htm

    it is show how dxBrush is being created/descroyed in separate event handler.
    It's a bit inconecnent while coding.

    so, does the following way has any drawback (instead of doing like said in example):
    Code:
    ...OnRender()
    {
        SharpDX.Direct2D1.Brush dxBrush = brushColor.ToDxBrush(RenderTarget);
        RenderTarget.FillRectangle(new SharpDX.RectangleF(ChartPanel.X, ChartPanel.Y, ChartPanel.W, ChartPanel.H), dxBrush)
        dxBrush.Dispose();
        dxBrush = null;
    }
    I like this because everything is in one place.
    is it worse then in the linked example?

    #2
    Hello TazoTodua,

    Thank you for your post.

    It is fine to create and destroy them in the same OnRender() call. The idea behind the OnRenderTargetChanged example is to show how to do this when the SharpDx Brush may be set or called elsewhere as well.

    Actually creating and destroying in the same OnRender() call is more desirable if there is no need to set the Brush anywhere else.

    Please let me know if you have any questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by doihaveto13, Today, 12:46 PM
    0 responses
    2 views
    0 likes
    Last Post doihaveto13  
    Started by MrAdamSK, 04-02-2024, 11:25 PM
    3 responses
    41 views
    0 likes
    Last Post NinjaTrader_Zachary  
    Started by lakman184, 03-24-2024, 01:30 PM
    7 responses
    35 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by DawnTreader, 05-08-2024, 05:58 PM
    20 responses
    80 views
    0 likes
    Last Post DawnTreader  
    Started by llanqui, Yesterday, 10:29 AM
    5 responses
    26 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Working...
    X