PrepAway - Latest Free Exam Questions & Answers

Which code segment should you insert at line 08?

You are creating a Windows Presentation Foundation (WPF) application by using Microsoft .NET Framework 3.5.
The application contains a window that programatically displays an image. The window contains a Grid control named theGrid. You write the following code segment.
(Line numbers are included for reference only.)

01 Image theImage = new Image();
02 theImage.Width = 200;
03 BitmapImage theBitmapImage = new BitmapImage();
04 theBitmapImage.BeginInit();
05 theBitmapImage.UriSource = new Uri("imageToDisplay.jpg");
06 theBitmapImage.DecodePixelWidth = 200;
07 theBitmapImage.EndInit();
08
09 theGrid.Children.Add(theImage);

You need to crop an elliptical region of the image such that the ellipse is centered at the location X=75 and Y=50.
Which code segment should you insert at line 08?

PrepAway - Latest Free Exam Questions & Answers

A.
CroppedBitmap croppedBitmap = new CroppedBitmap(theBitmapImage, new Int32Rect(75, 50, 105, 50));
theImage.Source = theBitmapImage;

B.
CroppedBitmap croppedBitmap = new CroppedBitmap();
croppedBitmap.Source = theBitmapImage;
croppedBitmap.SourceRect = new Int32Rect(75, 50, 105, 50);
theImage.Source = theBitmapImage;

C.
theImage.Source = theBitmapImage;
EllipseGeometry clipGeometry = new EllipseGeometry(new Point(75, 50), 50, 25);
theImage.Clip = clipGeometry;

D.
theImage.Source = theBitmapImage;
EllipseGeometry clipGeometry = new EllipseGeometry();
clipGeometry.Center = new Point(75, 50);
theImage.Clip = clipGeometry ;


Leave a Reply