Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

OnRender(): how to align text vertically?

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

    OnRender(): how to align text vertically?

    Hello. In NT7 we can use

    PHP Code:
    float Font.GetHeightGraphics graphics); 
    Can't find same way in SharpDX.DirectWrite.TextFormat

    Here is example of placing text with size 40 in rectangle with height 40
    PHP Code:
    SharpDX.DirectWrite.TextFormat text_format = new SharpDX.DirectWrite.TextFormat(NinjaTrader.Core.Globals.DirectWriteFactory"Arial"
    SharpDX.DirectWrite.FontWeight.RegularSharpDX.DirectWrite.FontStyle.NormalSharpDX.DirectWrite.FontStretch.Expanded40f);
                
    RectangleF rect = new RectangleF5050180040);
    RenderTarget.DrawText"AaBbCcDdEeFfGgHhJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"text_formatrect, new DxSolidColorBrushRenderTargetDxColor.Black ) );
    RenderTarget.DrawRectanglerect, new DxSolidColorBrushRenderTargetDxColor.White ) ); 
    Font height looks less than rectangle height, and it definitely aligned to bottom.
    Attached Files
    Last edited by fx.practic; 08-08-2017, 05:55 AM.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    Looks, this is it:

    PHP Code:
    text_format.ParagraphAlignment =  SharpDX.DirectWrite.ParagraphAlignment.Center
    Attached Files
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    Comment


      #3
      Hello fx.practic,

      Thank you for the update on this matter!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by arvidvanstaey, Today, 02:19 PM
      4 responses
      11 views
      0 likes
      Last Post arvidvanstaey  
      Started by samish18, 04-17-2024, 08:57 AM
      16 responses
      60 views
      0 likes
      Last Post samish18  
      Started by jordanq2, Today, 03:10 PM
      2 responses
      9 views
      0 likes
      Last Post jordanq2  
      Started by traderqz, Today, 12:06 AM
      10 responses
      18 views
      0 likes
      Last Post traderqz  
      Started by algospoke, 04-17-2024, 06:40 PM
      5 responses
      47 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X