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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    30 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    17 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    9 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    16 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    19 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X