Displays the current image and handles the canvas-level crop, draw, and pan interactions.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class ImageEditorCanvasElement : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemUIItemBaseLightVisualElementImageEditorCanvasElement...
Implements:
Inherited Members
Constructors
Initializes the canvas for the specified image editor.
public ImageEditorCanvasElement(RadImageEditorElement imageEditorElement)
The editor whose bitmap and zoom state are displayed.
Fields
Stores the current pointer position in canvas coordinates for building a drawing path.
protected Point mouseCurrentLocation
Stores the pointer-down position in canvas coordinates for building a drawing path.
protected Point mouseDownLocation
Stores the last control-coordinate pointer position used to calculate crop and pan movement deltas.
protected Point mouseLastLocation
Tracks whether the current pointer gesture moves the crop rectangle.
protected bool movingCropRect
Tracks whether a pointer gesture is actively dragging the image in pan mode.
protected bool panning
Tracks whether the current pointer gesture resizes the crop rectangle.
protected bool resizingCropRect
Properties
Gets the button that commits the current crop selection.
public RadButtonElement AcceptButton { get; }
Gets the button that cancels the current crop selection.
public RadButtonElement CancelButton { get; }
Gets or sets the size used to draw and hit-test the crop handles.
public Size CropHandlesSize { get; set; }
Gets a value indicating whether the canvas is in crop-selection mode.
public bool IsCropping { get; protected set; }
Gets a value indicating whether the canvas is in shape-drawing mode.
public bool IsDrawing { get; protected set; }
Gets a value indicating whether the canvas is in pan mode.
public bool IsPanning { get; protected set; }
Gets or sets the crop bounds as fractions of the displayed image rectangle.
protected RectangleF RelativeCropRect { get; set; }
Methods
Sets the cursor to indicate the crop handle under the specified location.
protected virtual void ChangeResizeCursor(Point location)
The pointer location in control coordinates.
Creates the crop accept and cancel buttons and hides them until cropping starts.
protected override void CreateChildElements()
Overrides:
Converts the relative crop bounds to a rectangle in the canvas's displayed-image coordinates.
Gets the zoom-scaled image bounds, centering the image on any axis where it is smaller than the canvas.
Builds the drawing path in source-bitmap coordinates for the active shape or freehand stroke.
protected virtual GraphicsPath GetShapePath()
The path defined by the current drawing gesture.
Hides the buttons used to commit or cancel crop selection.
public virtual void HideAcceptAndCancelButtons()
Uses the zoom-scaled bitmap size as the desired size when an image is loaded.
Moves the crop rectangle while keeping it within the displayed image bounds.
protected virtual void MoveCropRectangle(Point location)
The current pointer location in control coordinates.
Starts pointer capture and selects the crop, draw, or pan interaction for the current mode.
protected override void OnMouseDown(MouseEventArgs e)
The pointer-down location and button state.
Overrides:
Updates the active crop, draw, or pan interaction as the pointer moves.
protected override void OnMouseMove(MouseEventArgs e)
The current pointer location and button state.
Overrides:
Releases pointer capture and completes or resets the active canvas interaction.
protected override void OnMouseUp(MouseEventArgs e)
The pointer-up location and button state.
Overrides:
Changes zoom when the Control key is held while the mouse wheel is moved.
protected override void OnMouseWheel(MouseEventArgs e)
The wheel delta and pointer location.
Overrides:
Clears the active crop-move and crop-resize gesture state.
protected virtual void ResetMouseAndFlags()
Resizes the crop rectangle from the active edge or corner, constraining it to the image and a minimum one-pixel size.
protected virtual void ResizeCropRect(Point location)
The current pointer location in control coordinates.
Displays and localizes the buttons used to commit or cancel crop selection.
public virtual void ShowAcceptAndCancelButtons()
Starts crop selection when an image is loaded, resetting the selection to an inset region and stopping other operations.
public virtual void StartCrop()
Starts drawing the specified shape on the current image and stops other canvas operations.
public virtual void StartDrawing(ShapeInfo shapeInfo)
The shape type and appearance to use for the drawing operation.
Starts panning when an image is loaded and stops other canvas operations.
public virtual void StartPan()
Stops any active crop, draw, or pan operation.
public virtual void StopAllOperations()
Ends crop selection and returns its bounds in source-bitmap coordinates.
public virtual Rectangle StopCrop()
The selected rectangle in pixels of the current bitmap.
Ends the current shape-drawing operation.
public virtual void StopDrawing()
Ends panning and restores the default cursor.
public virtual void StopPan()