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.cs
59 lines (50 loc) · 1.88 KB
/
MyCalcEdit.cs
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
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraEditors.Registrator;
using DevExpress.XtraEditors.Drawing;
using 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 : CalcEdit {
static MyCalcEdit() {
RepositoryItemMyCalcEdit.Register();
}
public MyCalcEdit() {
}
int _lastClickedButton;
public override string EditorTypeName {
get { return RepositoryItemMyCalcEdit.EditorName; }
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public new RepositoryItemMyCalcEdit Properties {
get { return base.Properties as RepositoryItemMyCalcEdit; }
}
protected override void OnPressButton(EditorButtonObjectInfoArgs buttonInfo)
{
if (!buttonInfo.Button.Index.Equals(_lastClickedButton))
DestroyPopupForm();
_lastClickedButton = buttonInfo.Button.Index;
base.OnPressButton(buttonInfo);
}
protected override bool IsActionButton(EditorButtonObjectInfoArgs buttonInfo)
{
return base.IsActionButton(buttonInfo) || buttonInfo.Button.Index == Properties.SecondActionButtonIndex;
}
protected override DevExpress.XtraEditors.Popup.PopupBaseForm CreatePopupForm()
{
if (_lastClickedButton == Properties.ActionButtonIndex)
return base.CreatePopupForm();
if (_lastClickedButton== Properties.SecondActionButtonIndex)
return new MyCustomForm(this);
return null;
}
}
}