我想用动画旋转自定义形状。 当我运行我的应用程序时,我在我的即时窗口中收到此消息:
BindingExpression路径错误:'object'上找不到'Angle'属性 ''MatrixTransform'(HashCode = 16493105)'。空
我的形状
Dim myPointerPath = New Path()
Dim myPointerPathGeometry = New PathGeometry()
Dim myPointerPathFigure = New PathFigure()
Dim leftLine As New LineSegment
Dim rightLine As New LineSegment
myPointerPathFigure.StartPoint = New Point(Me.left + (Me.width / 2), Me.top + (Me.width / 60))
leftLine.Point = New Point(Me.left * 1.8, Me.top)
rightLine.Point = New Point(Me.left + (Me.width / 2), Me.top - Me.width / 60)
myPointerPathFigure.Segments.Add(leftLine)
myPointerPathFigure.Segments.Add(rightLine)
myPointerPathGeometry.Figures.Add(myPointerPathFigure)
myPointerPath.Data = myPointerPathGeometry
myPointerPath.Stroke = Me.pointerColor
myPointerPath.Fill = Me.pointerColor
myCanvas.Children.Add(myPointerPath)
Me.pointerShape = myPointerPathGeometry
对于单行形状,此代码会为旋转设置动画:
Public Sub drawPointerAtValue(ByVal p_value As Double)
Dim rotator = New RotateTransform(p_value)
Dim da = New DoubleAnimation(0, 180, New Duration(TimeSpan.FromSeconds(2)))
Dim storyboard = New Storyboard()
rotator.CenterX = pointerLine.X1
rotator.CenterY = pointerLine.Y1
storyboard.Children.Add(da)
storyboard.SetTarget(da, pointerLine)
storyboard.Duration = da.Duration
storyboard.SetTargetProperty(da, New PropertyPath("RenderTransform.Angle"))
storyboard.AccelerationRatio = 0.2
storyboard.DecelerationRatio = 0.2
da.to = p_value
storyboard.Begin()
End Sub
这是我的自定义形状(2线形)的旋转动画的代码
Public Sub rotateShape(ByVal p_value As Double)
Dim rotator = New RotateTransform(p_value)
Dim da = New DoubleAnimation(0, 180, New Duration(TimeSpan.FromSeconds(2)))
Dim storyboard = New Storyboard()
rotator.CenterX = Me.left + (Me.width / 2)
rotator.CenterY = Me.top
storyboard.Children.Add(da)
storyboard.SetTarget(da, pointerShape)
storyboard.Duration = da.Duration
storyboard.SetTargetProperty(da, New PropertyPath("Transform.Angle"))
storyboard.AccelerationRatio = 0.2
storyboard.DecelerationRatio = 0.2
da.To = p_value
storyboard.Begin()
End Sub
答案 0 :(得分:0)
我通过将形状更改为多边形而不是使用PathGeometry来实现它。
File filename = new File("E:/Test.xlsx");
FileInputStream isr= new FileInputStream(filename);
Workbook book1 = new XSSFWorkbook(isr);
Sheet sheet = book1.getSheetAt(0);
Iterator<Row> rowItr = sheet.rowIterator();