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

Properties for the SharpDX.Direct2D1.DashStyle enum

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

    Properties for the SharpDX.Direct2D1.DashStyle enum

    Hello,

    I'm using on Render to draw lines and would like to have the StrokeStyle parameter DashStyle user configurable. I have tried to use the built in SharpDX.Direct2D1.DashStyle enum, but i have a feeling it doesnt like this to be set publicly (in the properties section, not csl compliant warning in VisualStudio) and also when it comes to e.g. SharpDX.Direct2D1.DashStyle.Dash, trying to substitute .Dash for my enumerated variable is a no go too. Fairly new to all this so i may be missing something simple and obvious. Is there an simple way to use this enum? Did try using my own enum but seems very long winded way when one is already built in.

    Thanks!

    Col.

    #2
    Hello cdsmart,

    Thank you for the post.

    You can use DashStyleHelper to create a dash input, the only option which is missing is Custom so if you use that making your own selection is better.

    Code:
    public DashStyleHelper Helper {get;set;}
    To convert that to a sharpDX DashStyle you could do something like the following:
    Code:
    SharpDX.Direct2D1.DashStyle style = (SharpDX.Direct2D1.DashStyle)Enum.Parse(typeof(SharpDX.Direct2D1.DashStyle), Helper.ToString());
    The two enum's don't have exact int values for the different styles meaning they are ordered differently. You could parse the string name of the style from the helper and then cast that to the correct enum.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hey Jesse!

      Awesome! That works a treat and is more like what i thought it should be rather than my cumbersome enum solution.

      Thanks legend and have great day!

      Colin.

      Comment


        #4
        As a learning curve it would be nice to post the whole code :-)

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by yertle, Today, 12:24 PM
        0 responses
        2 views
        0 likes
        Last Post yertle
        by yertle
         
        Started by reekotubbs, Yesterday, 01:09 PM
        3 responses
        26 views
        0 likes
        Last Post reekotubbs  
        Started by Blaze212, 07-07-2024, 08:58 PM
        2 responses
        18 views
        0 likes
        Last Post Blaze212  
        Started by medicmiked, Today, 11:56 AM
        0 responses
        2 views
        0 likes
        Last Post medicmiked  
        Started by miaolivi9, Today, 06:59 AM
        0 responses
        8 views
        0 likes
        Last Post miaolivi9  
        Working...
        X