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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      579 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 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
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X