Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

I can't see the rendered text in the subpanel.

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

    I can't see the rendered text in the subpanel.

    Hello, everyone.
    I made something but it doesn't work well.

    Here is my code.
    Code:
    ...
    protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
            {
                base.OnRender(chartControl, chartScale);
                
                if (!IsInHitTest)
                {
                    SharpDX.Direct2D1.Brush color;        
                    color = Brushes.White.ToDxBrush(RenderTarget);
        
                    NinjaTrader.Gui.Tools.SimpleFont simpleFont = new NinjaTrader.Gui.Tools.SimpleFont("Arial", 16);
                    SharpDX.DirectWrite.TextFormat textFormat = simpleFont.ToDirectWriteTextFormat();
                    
                    string msg = trendStr;
                    
                    SharpDX.DirectWrite.TextLayout textLayout = new SharpDX.DirectWrite.TextLayout(NinjaTrader.Core.Globals.DirectWriteFactory, msg, textFormat, 400, textFormat.FontSize);
                    SharpDX.Vector2 lowerTextPoint = new SharpDX.Vector2(ChartPanel.W-textLayout.Metrics.Width, ChartPanel.H-textLayout.Metrics.Height);
                    RenderTarget.DrawTextLayout(lowerTextPoint, textLayout, color, SharpDX.Direct2D1.DrawTextOptions.NoSnap);
        
                    color.Dispose();
                    textFormat.Dispose();
                    textLayout.Dispose();
                }
            }​
    ...
    The problem is that when the IsOverlay is true, the text is displayed, but when the IsOverlay is false, the text is not displayed.
    Do I need to make any specific settings for these two cases?
    If not, what are some solutions?
    Thanks.​
    Attached Files

    #2
    Hello truepenny,

    Add ChartPanel.Y to the Vector2 y parameter to account for the upper panel.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    557 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X