-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyButtonEdit.cs
57 lines (50 loc) · 1.63 KB
/
MyButtonEdit.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
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.Controls;
using DevExpress.Utils.Drawing;
using DevExpress.XtraEditors.ViewInfo;
namespace WindowsApplication1
{
public class MyButtonEdit : ButtonEdit, IAutoHeightControl
{
static MyButtonEdit()
{
RepositoryItemMyButtonEdit.Register();
}
public override string EditorTypeName
{
get { return RepositoryItemMyButtonEdit.EditorName; }
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public new RepositoryItemMyButtonEdit Properties
{
get { return base.Properties as RepositoryItemMyButtonEdit; }
}
bool IAutoHeightControl.SupportsAutoHeight { get { return true; } }
public event EventHandler heightChanged;
event EventHandler IAutoHeightControl.HeightChanged
{
add { heightChanged += value; }
remove { heightChanged -= value; }
}
protected void RaiseHeightChanged()
{
if (heightChanged != null)
heightChanged(this, EventArgs.Empty);
}
int IAutoHeightControl.CalcHeight(GraphicsCache cache)
{
if (ViewInfo.IsReady)
{
IHeightAdaptable ih = ViewInfo as IHeightAdaptable;
if (ih != null) return ih.CalcHeight(cache, Width);
}
return Height;
}
}
}