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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      173 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      328 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      252 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      355 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      181 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X