This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyCalcEdit.vb
65 lines (56 loc) · 1.98 KB
/
MyCalcEdit.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
58
59
60
61
62
63
64
65
Imports Microsoft.VisualBasic
Imports System
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.XtraEditors.Registrator
Imports DevExpress.XtraEditors.Drawing
Imports DevExpress.XtraEditors.Popup
Namespace WindowsApplication1
''' <summary>
''' MyCalcEdit is a descendant from CalcEdit.
''' It displays a dialog form below the text box when the edit button is clicked.
''' </summary>
<System.ComponentModel.DesignerCategory("")> _
Public Class MyCalcEdit
Inherits CalcEdit
Shared Sub New()
RepositoryItemMyCalcEdit.Register()
End Sub
Public Sub New()
End Sub
Private _lastClickedButton As Integer
Public Overrides ReadOnly Property EditorTypeName() As String
Get
Return RepositoryItemMyCalcEdit.EditorName
End Get
End Property
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
Public Shadows ReadOnly Property Properties() As RepositoryItemMyCalcEdit
Get
Return TryCast(MyBase.Properties, RepositoryItemMyCalcEdit)
End Get
End Property
Protected Overrides Sub OnPressButton(ByVal buttonInfo As EditorButtonObjectInfoArgs)
If (Not buttonInfo.Button.Index.Equals(_lastClickedButton)) Then
DestroyPopupForm()
End If
_lastClickedButton = buttonInfo.Button.Index
MyBase.OnPressButton(buttonInfo)
End Sub
Protected Overrides Function IsActionButton(ByVal buttonInfo As EditorButtonObjectInfoArgs) As Boolean
Return MyBase.IsActionButton(buttonInfo) OrElse buttonInfo.Button.Index = Properties.SecondActionButtonIndex
End Function
Protected Overrides Function CreatePopupForm() As DevExpress.XtraEditors.Popup.PopupBaseForm
If _lastClickedButton = Properties.ActionButtonIndex Then
Return MyBase.CreatePopupForm()
End If
If _lastClickedButton= Properties.SecondActionButtonIndex Then
Return New MyCustomForm(Me)
End If
Return Nothing
End Function
End Class
End Namespace