locked
Blend Random Position Number RRS feed

  • Question

  • User539648229 posted

    Hi

    I'm using PathGradientBrush and when I create an instance of it(with constructor that takes only a GraphicsPath), its Blend property has Position that has random value like 2.9231155E+29 or 1.34545E-19 etc. This causes my unit tests fail sometimes. When I debug, these numbers sometimes change when I'm steping in the code. what can I do?

    Thanks

    Saturday, January 18, 2014 6:22 AM

Answers

  • User539648229 posted

    Hi galeny

    As you said they are similar but totally about different Problems. On that post I had problem of what is a valid Blend. In this post I'm talking about problem of unassigned Blend Property of another object in my tests. Any way I think the answer is found. Unassigned Blend has only one element of factor and position. I can totally ignore this situation in my tests.

    Thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 21, 2014 5:26 AM

All replies

  • User-933407369 posted

    hi,

    According to your description, had you try to use the following properties?

    Blend blend = new Blend();  
            blend.Factors = new float[] { 1, 0, 1, 0, 1 };  
            blend.Positions = new float[] { 0, 0.20f, 0.5f, 0.70f, 1f };  
            pathGradientBrush.Blend = blend;  
    

    please refer the link below for details:

    how to use PathGradientBrush Blend in c#

    http://asp-net-example.blogspot.in/2012/05/how-to-use-pathgradientbrush-blend-in-c.html

    Hope it helps you.

    Sunday, January 19, 2014 10:27 PM
  • User539648229 posted

    Hi

    I mean when I create the PathGradientBrush Object and do not assign anything to its Blend Property.

     

    Monday, January 20, 2014 5:58 AM
  • User-227760790 posted

    you post a similar post on the thread: http://forums.asp.net/t/1962197.aspx

    please take care of it.

    Monday, January 20, 2014 8:11 PM
  • User539648229 posted

    Hi galeny

    As you said they are similar but totally about different Problems. On that post I had problem of what is a valid Blend. In this post I'm talking about problem of unassigned Blend Property of another object in my tests. Any way I think the answer is found. Unassigned Blend has only one element of factor and position. I can totally ignore this situation in my tests.

    Thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 21, 2014 5:26 AM
  • User-933407369 posted

    Thanks for your reply. I'm glad that you have found the solution:

    when you create the PathGradientBrush Object,

    if it  has only one element of factor and position, you can Unassign Blend property.

    but if it  has many elements of factor and position, you must assign to its Blend Property( factor and position are array).

    Best Regrds.

     

     

    Tuesday, January 21, 2014 9:52 PM