PrepAway - Latest Free Exam Questions & Answers

Which code segment should you insert at line 04?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
The application has a window that programatically displays an image. The window contains a grid named theGrid. The window displays images in their actual size. You want the images to be 200 pixels wide. You write the following code segment.

01 Image theImage = new Image();
02 theImage.Width = 200;
03 BitmapImage theBitmapImage = new BitmapImage();
04
05 theImage.Source = theBitmapImage;
06 theGrid.Children.Add(theImage);

You need to ensure that the application meets the following requirements:

* The window uses the least amount of memory to display the image.
* The image is not skewed.

Which code segment should you insert at line 04?

PrepAway - Latest Free Exam Questions & Answers

A.
theBitmapImage.UriSource = new Uri("imageToDisplay.jpg")
theBitmapImage.DecodePixelWidth = 200

B.
theBitmapImage.BeginInit()
theBitmapImage.UriSource = New Uri("imageToDisplay.jpg")
theBitmapImage.EndInit()

C.
theBitmapImage.BeginInit()
theBitmapImage.UriSource = New Uri("imageToDisplay.jpg")
theBitmapImage.DecodePixelWidth = 200
theBitmapImage.EndInit()

D.
theBitmapImage.BeginInit()
theBitmapImage.UriSource = New Uri("imageToDisplay.jpg")
theBitmapImage.EndInit()
theBitmapImage.DecodePixelWidth = 200
theBitmapImage.DecodePixelHeight = 200


Leave a Reply