tailieunhanh - programming windows phone 7 phần 6
Điều này thực sự hoạt động trong ví dụ này, nhưng nó rất, rất sai. Vấn đề là tài sản Nội dung của Button là kiểu của đối tượng. Chúng ta có thể thiết lập nó để hình ảnh bất cứ điều gì, Panel, Shape một, RadialGradientBrush một, và sau đó TextBlock sẽ có một vấn đề nhỏ. | true The monochromized WriteableBitmap is set to the Source property of the Image element and the save button is enabled. Pressing the save button navigates to the page in the library. As you ve just seen the SaveFileDialog class handles its OnNavigatedFrom override by calling the SaveFileDialogCompleted method in the class that it s navigating to Silverlight Project Monochromize File excerpt void OnAppbarSaveClick object sender EventArgs args new Uri component public void SaveFileDialogCompleted bool okPressed string filename if okPressed MemoryStream memoryStream new MemoryStream 495 memoryStream wri 0 75 0 MediaLibrary mediaLib new MediaLibrary filename memoryStream The SaveFileDialogCompleted method uses the filename entered by the user to write the bitmap to the pictures library. This happens in two steps First the SaveJpeg method writes the WriteableBitmap to a Memorystream in JPEG format. The Position on the Memorystream is then reset and the stream is saved to the pictures library. The Monochromize program also handles tombstoning. The OnNavigatedFrom method uses the SaveJpeg extension method to write to a MemoryStream and then saves the byte array. This method is also responsible for calling SetTitle on the SaveFileDialog if navigating to that page Silverlight Project Monochromize File excerpt protected override void OnNavigatedFrom NavigationEventArgs args if writeableBitmap null MemoryStream stream new MemoryStream stream dth 0 75 jpegBits if is SaveFileDialog SaveFileDialog page as SaveFileDialog .
đang nạp các trang xem trước