<Button Canvas.Left="159" Canvas.Top="87" Height="35" Name="button2" Width="36" IsCancel="False" Click="button2_Click"> <Image Source="/WpfApplication1;component/bin/Debug/结束.png"></Image> </Button>//停止服务 private void button2_Click(object sender, RoutedEventArgs e) { Uri uri = new Uri("结束-灰色.png", UriKind.Relative); BitmapImage bimg = new BitmapImage(uri); button2.Background = new ImageBrush(bimg); }现在我在Click事件里面写没效果?
2 回答
元芳怎么了
TA贡献1798条经验 获得超7个赞
private void button2_Click(object sender, RoutedEventArgs e)
{
Uri uri = new Uri("图片路径", UriKind.Relative);
BitmapImage bimg = new BitmapImage(uri);
button2.Background = new ImageBrush(bimg);
}
在Windows Phone8 里面不能这样写啊!
它说button2.Background = new ImageBrush(bimg);有错
- 2 回答
- 0 关注
- 632 浏览
添加回答
举报
0/150
提交
取消