nếu bạn muốn xem hình ảnh đơn giản hỗ trợ cảm ứng đa điểm, tôi khuyên bạn nên sử dụng điều khiển WebBrowser
để hiển thị hình ảnh.
Nó hỗ trợ thu phóng đa chạm và cuộn mượt mà theo mặc định. Nhưng bạn phải sao chép tệp vào bộ nhớ bị cô lập khỏi thư mục dự án. Đây là cách tôi đã thực hiện:
<Grid x:Name="LayoutRoot" Background="Transparent">
<phone:WebBrowser
Name="MyWebBrowserControl"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0" />
</Grid>
IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
// if image file does not exist in isolated storage, copy it to there~!
if (!isf.FileExists(filename))
{
StreamResourceInfo sr = Application.GetResourceStream(new Uri(filename, UriKind.Relative));
using (BinaryReader br = new BinaryReader(sr.Stream))
{
byte[] data = br.ReadBytes((int)sr.Stream.Length);
using (BinaryWriter bw = new BinaryWriter(isf.OpenFile(filename, FileMode.OpenOrCreate)))
{
bw.Write(data);
bw.Close();
}
br.Close();
}
}
Dispatcher.BeginInvoke(() => { MyWebBrowserControl.Navigate(new Uri(filename, UriKind.Relative)); });
※ Bạn phải thiết lập các Build Action của tập tin hình ảnh để Content
Nguồn
2012-02-02 12:43:17
hai lựa chọn tốt cung cấp cho đến nay –