Announcement

Collapse
No announcement yet.

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.

    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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        672 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        379 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        111 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        577 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        582 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X