Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to change font

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

    How to change font

    I'd be grateful for some help in doing something very simple. All I want to do is change the font size after I have created a text object.

    I've tried a variety of code. This code, for example, gives me a compile error "use of unassigned local variable 'mytag'"
    Code:
     
    IText mytag;
     
     
    if (Highs[1][0] >= 900) mytag = DrawText(tag, "up", 0, Highs[0][0], tagBlack);
     
    if (Lows[1][0] <= -900) mytag = DrawText(tag, "dn", 0, Lows[0][0], tagBlack);
     
    mytag.Font = new Font("Arial", 12);
    If I remove the last line (which I need to change the font size) then it compiles OK.

    Thanks

    #2
    Hi bubblegum,

    Have you tried declaring the variable first? Something like...
    In the variables region...
    Font mytag;

    then...
    mytag = new Font("Arial", 12);
    TimNinjaTrader Customer Service

    Comment


      #3
      Thanks for the post Tim -- I needed to do the same as bubblegum. Your suggestion works perfectly.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      155 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      90 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      137 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      130 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      107 views
      0 likes
      Last Post CarlTrading  
      Working...
      X