How to draw a smooth curved line in WPF?

后端 未结 2 819
小鲜肉
小鲜肉 2021-02-20 16:38

I have three known positions, and currently I am driving two lines like so:

Line line = new Line
{
    StrokeThickness = 3,
    Stroke = lineColor,
    X1 = MyX,         


        
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-20 17:16

    I think you are looking for splines

    http://msdn.microsoft.com/en-us/library/554h284b.aspx

    Gabe is correct that is from Forms

    Under WPF you could try a PolyBezierSegment but it require 4 points. Possible you could put in three points and 1 more to shape it.

    
        
            
                
                    
                            
                            
                                
                                    
                                        
                                    
                                
                            
                        
                    
                
            
        
    
    

    This results in the following curve

    enter image description here

提交回复
热议问题