RadPictureBoxElement
This class is used to display raster or vector images. It allows image scrolling as well as pan, zoom, image editing and many more.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class RadPictureBoxElement : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemUIItemBaseLightVisualElementRadPictureBoxElement...
Implements:
Inherited Members
Constructors
Initializes a new instance of the RadPictureBoxElement class.
public RadPictureBoxElement()
Properties
Gets or sets a value indicating whether to show animations when showing and hiding panels. Note that animations are applied only when PanelDisplayMode is set to OnMouseHover.
public bool AllowPanelAnimations { get; set; }
Gets the bottom panel element. This panel allows adding buttons label and other elements in three collections - left, center and right items.
public PictureBoxHorizontalPanelElement BottomPanel { get; }
Gets the element that is responsible for painting the image.
public PictureBoxCanvasElement CanvasElement { get; }
Gets the context menu.
public RadContextMenuDropDown ContextMenu { get; }
Gets or sets a value indicating whether to display context menu on right mouse click.
[Browsable(false)]
public bool ContextMenuEnabled { get; set; }
Gets the context menu related properties.
public PictureBoxContextMenuProperties ContextMenuProperties { get; }
Gets the horizontal scrollbar element.
public RadScrollBarElement HorizontalScrollBar { get; }
Gets or sets the alignment of the image on the drawing surface. Default is TopLeft. Note that this property is respected only when the ImageLayout is set to None.
public override ContentAlignment ImageAlignment { get; set; }
Overrides:
Gets or sets the dialog responsible for image editing.
public PictureBoxImageEditorDialog ImageEditorDialog { get; set; }
Gets the left panel element. This panel allows adding buttons label and other elements in three collections - top, center and bottom items.
public PictureBoxVerticalPanelElement LeftPanel { get; }
Gets the element that holds the image visible when there is no image(raster or vector) assigned.
public LightVisualElement NoPictureImageElement { get; }
Gets the StackLayoutPanel that is displayed when there is no image(raster or vector) assigned.
public StackLayoutPanel NoPictureStack { get; }
Gets the element that holds the text visible when there is no image(raster or vector) assigned.
public LightVisualElement NoPictureTextElement { get; }
Gets or sets a value indicating how the panels are displayed. The possible options are: always or on mouse hover.
public PictureBoxPanelDisplayMode PanelDisplayMode { get; set; }
Gets or sets a value indicating how the panels are positioned.
public PictureBoxPanelOverflowMode PanelOverflowMode { get; set; }
Specifies how the image is positioned on the element.
public virtual RadImageLayout RadImageLayout { get; set; }
Determines if users can only view the image with no interaction: zoom and context menu are not available when read only is true.
[Browsable(true)]
public bool ReadOnly { get; set; }
Gets the right panel element. This panel allows adding buttons label and other elements in three collections - top, center and bottom items.
public PictureBoxVerticalPanelElement RightPanel { get; }
Gets or sets a value indicating whether to display scrollbars when the displayed image is larger than the element.
public bool ShowScrollBars { get; set; }
Gets the top panel element. This panel allows adding buttons label and other elements in three collections - left, center and right items.
public PictureBoxHorizontalPanelElement TopPanel { get; }
Gets the vertical scrollbar element.
public RadScrollBarElement VerticalScrollBar { get; }
Gets the properties responsible for the zoom operations.
public PictureBoxZoomProperties ZoomProperties { get; }
Methods
Arranges the RadPictureBoxElement to its final location. The element must call the Arrange method of each of its children.
protected override SizeF ArrangeOverride(SizeF finalSize)
The size that is available for element.
Returns:The rectangle occupied by the element. Usually finalSize. Should you return different size, the Layout system will restart measuring and rearranging the items. That could lead to infinite recursion.
Overrides:
In this method call to the Arrange method of each child must be made.
Removes the image and/or svg image.
public virtual void ClearImage()
Copies the displayed image into the clipboard.
public virtual void CopyImage()
protected virtual PictureBoxHorizontalPanelElement CreateBottomPanel()
Called by the element when constructed. Allows inheritors to build the element tree.
protected override void CreateChildElements()
Overrides:
protected virtual PictureBoxContextMenuProperties CreateContextMenuProperties()
protected virtual RadScrollBarElement CreateHorizontalScrollBarElement()
protected virtual PictureBoxVerticalPanelElement CreateLeftPanel()
protected virtual PictureBoxVerticalPanelElement CreateRightPanel()
protected virtual PictureBoxHorizontalPanelElement CreateTopPanel()
protected virtual RadScrollBarElement CreateVerticalScrollBarElement()
protected virtual PictureBoxZoomProperties CreateZoomProperties()
Copies the displayed image into the clipboard and clears the displayed image.
public virtual void CutImage()
Disposes of managed resources including cached images and SVG images when the element is being disposed.
protected override void DisposeManagedResources()
Overrides:
Edits the image using a RadImageEditor displayed in a PictureBoxImageEditorDialog.
public void EditImage()
protected virtual void EnableContextMenuItems()
Hides the panels.
public virtual void HidePanels(bool animate = true)
A value indicating whether to use animation.
Initializes member fields to their default values. This method is called prior the CreateChildItems one and allows for initialization of members on which child elements depend.
protected override void InitializeFields()
Overrides:
Opens an OpenFileDialog which allows the user to choose an image.
public virtual void LoadImage()
Measures the desired size of the element by calculating the space needed for content, padding, and borders.
Handles the bounds changed event by updating the fill primitive implementation and invoking the base class handler.
protected override void OnBoundsChanged(RadPropertyChangedEventArgs e)
Event arguments containing information about the property change, including the old bounds value.
Overrides:
Raises the ContextMenuClosed event.
protected virtual void OnContextMenuClosed()
Raises the ContextMenuClosing event.
protected virtual void OnContextMenuClosing(CancelEventArgs args)
The event arguments
Raises the ContextMenuOpened event.
protected virtual void OnContextMenuOpened()
Raises the ContextMenuOpening event.
protected virtual void OnContextMenuOpening(CancelEventArgs args)
The event arguments
[Obsolete("Override OnImageLoaded(ImageKind, LoadImageContext, string) instead.")]
protected virtual void OnImageLoaded()
protected virtual void OnImageLoaded(ImageKind imageKind, LoadImageContext loadContext, string filePath = null)
protected virtual void OnImageSaved()
Called when a mouse button is pressed down over the item.
protected override void OnMouseDown(MouseEventArgs e)
The mouse event arguments.
Overrides:
Called when the mouse moves over the item, handling highlight and border highlight effects.
protected override void OnMouseMove(MouseEventArgs e)
The mouse event arguments.
Overrides:
Called when a mouse button is released over the item.
protected override void OnMouseUp(MouseEventArgs e)
The mouse event arguments.
Overrides:
Raises the MouseWheel event.
protected override void OnMouseWheel(MouseEventArgs e)
The mouse event arguments.
Overrides:
protected virtual void OnPanChanged()
protected virtual void OnPanelDisplayModeChanged()
protected virtual void OnPanelOverflowModeChanged()
Notifies for a change in the Parent value.
protected override void OnParentChanged(RadElement previousParent)
The previous parent element (if any)
Overrides:
Handles property change events by invalidating the fill cache and invoking the base class property change handler.
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
Event arguments containing information about the property that changed.
Overrides:
protected virtual void OnRadImageLayoutChanged()
protected virtual void OnZoomChanged()
Fires the ZoomGesture event.
protected override void OnZoomGesture(ZoomGestureEventArgs args)
The arguments for the ZoomGesture event.
Overrides:
Pastes an image from the clipboard.
public virtual void PasteImage()
protected virtual void ProcessMouseWheelScroll(MouseEventArgs e, RadScrollBarElement scrollBar)
protected virtual void ResetPanAndZoom()
Opens a SaveFileDialog which allows the user to save the displayed image.
public virtual void SaveImage()
This method is not relevant for this class.
public override void SetAllLocalValuesAsDefault(bool recursive)
True to apply recursively to all descendants, false for this element only.
Overrides:
Gets a value indicating, whether a child will be arranged during the ArrangeOverride.
protected override bool ShouldArrangeChild(RadElement child)
The child.
Returns:Whether the child will be arranged in ArrangeOverride.
Overrides:
Shows the panels.
public virtual void ShowPanels(bool animate = true)
A value indicating whether to use animation.
protected virtual void UnwireParentControl()
protected virtual void UpdateParentControl()
protected virtual void UpdatePictureElementPanZoomAndSize()
protected virtual void WireParentControl()
Performs a zoom-in operation with one step, according to the ZoomProperties.ZoomStep value.
public void ZoomIn()
Performs a zoom-in operation with several steps, according to the ZoomProperties.ZoomStep value.
Performs a zoom-out operation with one step, according to the ZoomProperties.ZoomStep value.
public void ZoomOut()
Performs a zoom-out operation with several steps, according to the ZoomProperties.ZoomStep value.
Events
Occurs when the context menu is closed.
public event EventHandler ContextMenuClosed
Occurs when the context menu is closing.
public event CancelEventHandler ContextMenuClosing
Occurs when an item in the context menu is clicked.
public event HandledEventHandler ContextMenuItemClick
Occurs when the context menu is opened.
public event EventHandler ContextMenuOpened
Occurs when the context menu is opening.
public event CancelEventHandler ContextMenuOpening
Occurs when the image has been edited by the ImageEditorDialog and the user has accepted the changes. Can be handled. Note that this event fill be fired always when the user clicks the OK button of the dialog, even if there are no changes in the image.
public event PictureBoxImageEditedEventHandler ImageEdited
Occurs when the image is about to be edited in the ImageEditorDialog. Cancellable.
public event PictureBoxImageEditorOpeningEventHandler ImageEditorOpening
Occurs when a raster or vector(SVG) image has been loaded by the user.
public event EventHandler ImageLoaded
Occurs when the displayed image has been saved by the user.
public event EventHandler ImageSaved
Occurs when the PositionOffset property of PictureBoxCanvasElement is changed.
public event EventHandler PanChanged
Raised after the ZoomFactor is changed.
public event EventHandler ZoomChanged