this.Resources.Add(Guid.NewGuid().ToString(), s)
DoubleAnimation da = new DoubleAnimation()
Storyboard.SetTarget(da, 你的Image)
Storyboard.SetTargetProperty(da, new PropertyPath("Opacity", new object[]{}))
da.From = 0
da.To = 1
s.Duration = new Duration(TimeSpan.FromSecond(1))
s.Children.Add(da)
s.Begin()
手敲的没验证呢 如果有问题不好意思啦
这是因为标签没有内容。
在下面这两行中间,
Label button1 = new Label()
abc.Children.Add(button1)
添加:
button1.Content="这是个标签按钮"
==================
Label button1 = new Label()
button1.Content="这是个标签按钮"
abc.Children.Add(button1)
结果如下:
一般不这么直接将图片放到canvas中,可以<Grid>
<Image name="imageContainer"></Image>
<Canvas Name="Image"></Canvas>
</Grid>
CS代码
image 是图片的二进制数组,
或者将图片文件读取到stream中都可以。
MemoryStream stream = new MemoryStream(image)
BitmapImage bitmapImage = new BitmapImage()
bitmapImage.BeginInit()
bitmapImage.StreamSource = stream
bitmapImage.EndInit()
imageShow.Source = bitmapImage
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)