嘿,我试图在主窗口背景图像中淡入淡出。在背景图片中淡入淡出
目前,这是我的代码:
10 Dim storyboard__1 As New Storyboard()
20 Dim duration As New TimeSpan(0, 0, 1)
30 Dim animation As New DoubleAnimation()
50 animation.From = 0.0
60 animation.[To] = 1.0
70 animation.Duration = New Duration(duration)
90 Storyboard.SetTargetName(animation, "C:\Users\someone\Downloads\cabd.jpg")
100 Storyboard.SetTargetProperty(animation, New PropertyPath(Control.OpacityProperty))
110 storyboard__1.Children.Add(animation)
120 storyboard__1.Begin(Me.Background)
的错误是在与Me.Background线120。
错误BC30518重载决策失败,因为没有可访问的“开始”可以用这些参数调用: “公共重载分开始(containingObject作为FrameworkElement的)”类型“刷”的值不能转换为“FrameworkElement的” 。 'Public Overloads Sub Begin(containsObject As FrameworkContentElement)':类型'Brush'的值不能转换为'FrameworkContentElement'。 scrollView
为了在mainWindow上调用图像淡化动画,我错过了什么?
我得到的错误**尝试,当上,因为对象是密封或冻结“System.Windows.Media.SolidColorBrush”不能动画“不透明度”属性**。 – StealthRT
因此,您没有将ImageBrush分配给目标元素的Background?你不是说你想“淡入背景图像”吗? – Clemens
是的,但是mainWindow没有已经可以使用的** Background **属性? – StealthRT