The WinForms PictureEdit control integrates an image editor that allows users to perform common graphic operations:
- Crop and straighten
- Adjust brightness, contrast, and saturation
- Mirror
- Rotate, etc.
This example shows how to extend the image editor. The example adds custom commands that allow you to watermark the image:
-
Create a
BaseCachedGraphicOperation
descendant class (WatermarkGraphicOperation
). Users can undo and redo BaseCachedGraphicOperations while the image editor is active. See WatermarkToolControl.cs for implementation details. -
You can allow users to specify the operation's settings in custom controls before the operation is applied. Create a panel with controls and implement the
IToolSettingsControl
interface for the panel. TheIToolSettingsControl.GetOperation
method must return the customized graphic operation (WatermarkGraphicOperation).This example creates a user control (WatermarkToolControl) with controls to enter the watermark-related settings:
- TextEditor to enter the watermark text
- ColorEditor to specify the font color
- SpinEditor to enter the font size
- CheckEditor to allow the watermark text to be repeated throughout the image.
-
Handle the PictureEdit.ImageEditorDialogShowing event to add custom commands (buttons) to the editor's main toolbar.
This example adds two commands:
- WatermarkPreset - Invokes the WatermarkGraphicOperation with predefined settings.
- WatermarkCommand - Displays the WatermarkToolControl in which users can specify custom watermark settings and then apply the WatermarkGraphicOperation.
(you will be redirected to DevExpress.com to submit your response)