C# Класс PhotoSharingApp.Universal.Controls.CropControl

A crop control that allows the user to crop images to a 1:1 ratio before uploading.
Наследование: Windows.UI.Xaml.Controls.Control, ICropControl, INotifyPropertyChanged
Показать файл Открыть проект

Private Properties

Свойство Тип Описание
AddCornerEvents void
Corner_PointerMoved void
Corner_PointerPressed void
Corner_PointerReleased void
RemoveCornerEvents void
SelectRegion_ManipulationCompleted void
SelectRegion_ManipulationDelta void
UpdatePreviewImage void
selectedRegion_PropertyChanged void
sourceImage_SizeChanged void

Открытые методы

Метод Описание
CropControl ( ) : System

Initializes a new instance of the CropControl class.

Dispose ( ) : void

Releases resources and unregisters from event handlers.

GetCroppedImage ( ) : Task

Creates the non-scaled cropped image.

LoadImage ( IRandomAccessStream fileStream ) : System.Threading.Tasks.Task

Loads the image.

Защищенные методы

Метод Описание
OnApplyTemplate ( ) : void

Template to manage crop selection of image.

Приватные методы

Метод Описание
AddCornerEvents ( Control corner ) : void

Adds pointer events to the given control.

Corner_PointerMoved ( object sender, PointerRoutedEventArgs e ) : void

If a pointer which is captured by the corner moves,the select region will be updated.

Corner_PointerPressed ( object sender, PointerRoutedEventArgs e ) : void

If a pointer presses in the corner, it means that the user starts to move the corner. 1. Capture the pointer, so that the UIElement can get the Pointer events (PointerMoved, PointerReleased...) even the pointer is outside of the UIElement. 2. Record the start position of the move.

Corner_PointerReleased ( object sender, PointerRoutedEventArgs e ) : void

The pressed pointer is released, which means that the move is ended. 1. Release the Pointer. 2. Clear the position history of the Pointer.

RemoveCornerEvents ( Control corner ) : void

Remove pointer events for the corner.

SelectRegion_ManipulationCompleted ( object sender, ManipulationCompletedRoutedEventArgs e ) : void

The manipulation is completed, and then update the preview image

SelectRegion_ManipulationDelta ( object sender, ManipulationDeltaRoutedEventArgs e ) : void

The user manipulates the selectRegion. The manipulation includes 1. Translate 2. Scale

UpdatePreviewImage ( ) : void

Updates the preview image.

selectedRegion_PropertyChanged ( object sender, PropertyChangedEventArgs e ) : void

Show the select region information.

sourceImage_SizeChanged ( object sender, SizeChangedEventArgs e ) : void

This event will be fired when 1. An new image is opened. 2. The source of the sourceImage is set to null. 3. The view state of this application is changed.

Описание методов

CropControl() публичный Метод

Initializes a new instance of the CropControl class.
public CropControl ( ) : System
Результат System

Dispose() публичный Метод

Releases resources and unregisters from event handlers.
public Dispose ( ) : void
Результат void

GetCroppedImage() публичный Метод

Creates the non-scaled cropped image.
public GetCroppedImage ( ) : Task
Результат Task

LoadImage() публичный Метод

Loads the image.
The file stream must not be null
public LoadImage ( IRandomAccessStream fileStream ) : System.Threading.Tasks.Task
fileStream IRandomAccessStream The file stream.
Результат System.Threading.Tasks.Task

OnApplyTemplate() защищенный Метод

Template to manage crop selection of image.
protected OnApplyTemplate ( ) : void
Результат void