Announcement

Collapse
No announcement yet.

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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    68 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    151 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    100 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    288 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X