Windows Phone 7 位图编程
Image控件的寫(xiě)法
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Image Name="img" />
</Grid>
?
?
?
通過(guò)System.Windows.Controls.Control.ManipulationStarted事件來(lái)進(jìn)行調(diào)用這這個(gè)方法覆蓋了System.Windows.UIElement.OnManipulationStarted(System.Windows.Input.ManipulationStartedEventArgs)。
加載網(wǎng)絡(luò)的圖片資源
protected override void OnManipulationStarted(ManipulationStartedEventArgs args)
{
Uri uri = new Uri("http://www.website.com/image/a.jpg");
BitmapImage bmp = new BitmapImage(uri);
img.Source = bmp;
?
args.Complete();
args.Handled = true;
base.OnManipulationStarted(args);
}
?
加載本地的圖片資源
protected override void OnManipulationStarted(ManipulationStartedEventArgs args)
{
Uri uri = new Uri("../Images/Hello.png", UriKind.Relative);
StreamResourceInfo resourceInfo = Application.GetResourceStream(uri);
BitmapImage bmp = new BitmapImage();
bmp.SetSource(resourceInfo.Stream);
img.Source = bmp;
?
args.Complete();
args.Handled = true;
base.OnManipulationStarted(args);
}
窗體頂端
本文轉(zhuǎn)自linzheng 51CTO博客,原文鏈接:http://blog.51cto.com/linzheng/1079238
?
總結(jié)
以上是生活随笔為你收集整理的Windows Phone 7 位图编程的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: zabbix自定义监控脚本,显示权限不足
- 下一篇: MySQL主从介绍、准备工作、配置主、配