/
Form1.vb
57 lines (52 loc) · 2.21 KB
/
Form1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Imports DevExpress.Utils.Svg
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.ImageEditor
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports System.Windows.Forms
Namespace WatermarkDemo
Partial Public Class Form1
Inherits XtraForm
Public Sub New()
InitializeComponent()
AddHandler pictureEdit1.ImageEditorDialogShowing, AddressOf PictureEdit1_ImageEditorDialogShowing
End Sub
Private Sub PictureEdit1_ImageEditorDialogShowing(ByVal sender As Object, ByVal e As ImageEditorDialogShowingEventArgs)
e.Commands.Insert(0, New WatermarkCommand() With {.Image = svgImageCollection1(0)})
e.Commands.Insert(1, New WatermarkPreset() With {.Image = svgImageCollection1(1)})
End Sub
Private Sub btnShowImageEditor_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnShowImageEditor.Click
pictureEdit1.ShowImageEditorDialog()
End Sub
End Class
Public Class WatermarkCommand
Implements IGraphicCommand
Public Overridable Property Image As SvgImage Implements IGraphicCommand.Image
Public Overridable ReadOnly Property ToolTip() As String Implements IGraphicCommand.ToolTip
Get
Return "Add Watermark"
End Get
End Property
Public Overridable Sub Execute(ByVal editorControl As ImageEditorControl) Implements IGraphicCommand.Execute
editorControl.SetActiveTool(New WatermarkToolControl())
End Sub
End Class
Public Class WatermarkPreset
Inherits WatermarkCommand
Public Overrides ReadOnly Property ToolTip() As String
Get
Return "Watermark Preset"
End Get
End Property
Public Overrides Sub Execute(ByVal editorControl As ImageEditorControl)
' Perform the WatermarkGraphicOperation operation in code, using the EditController. Users can undo this operation while the Image Editor is active.
editorControl.EditController.DoOperation(New WatermarkGraphicOperation("devexpress.com", Color.LightBlue, 15, True))
End Sub
End Class
End Namespace