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 CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    237 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    152 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    163 views
    1 like
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    246 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    199 views
    0 likes
    Last Post CarlTrading  
    Working...
    X