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 aussugardefender, Today, 01:07 AM
      0 responses
      3 views
      0 likes
      Last Post aussugardefender  
      Started by pvincent, 06-23-2022, 12:53 PM
      14 responses
      238 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      384 views
      1 like
      Last Post Gavini
      by Gavini
       
      Started by oviejo, Today, 12:28 AM
      0 responses
      4 views
      0 likes
      Last Post oviejo
      by oviejo
       
      Started by pechtri, 06-22-2023, 02:31 AM
      10 responses
      125 views
      0 likes
      Last Post Leeroy_Jenkins  
      Working...
      X