/
CustomFontEdit.cs
64 lines (58 loc) · 2 KB
/
CustomFontEdit.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
60
61
62
63
64
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.XtraEditors;
using System.ComponentModel;
using DevExpress.XtraEditors.Popup;
using System.Drawing;
using System.Windows.Forms;
namespace CustomFontEditControl
{
class CustomFontEdit : FontEdit
{
// static constructor
static CustomFontEdit() { RepositoryItemCustomFontEdit.RegisterCustomFontEdit(); }
// public constructor
public CustomFontEdit() { }
FontDialogCommonForm protPopupCommonForm;
FontDialogCommonForm PopupCommonForm
{
get
{
if (protPopupCommonForm == null)
{
protPopupCommonForm = new FontDialogCommonForm(this.Properties);
protPopupCommonForm.FormBorderStyle = FormBorderStyle.FixedDialog;
protPopupCommonForm.Text = ""; protPopupCommonForm.ControlBox = false;
}
return protPopupCommonForm;
}
}
// ovverride property
public override string EditorTypeName
{
get { return RepositoryItemCustomFontEdit.CustomFontEditorName; }
}
// property as corresponded repositoryitem
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public new RepositoryItemCustomFontEdit Properties
{
get { return base.Properties as RepositoryItemCustomFontEdit; }
}
protected override PopupBaseForm CreatePopupForm()
{
Rectangle bounds = CalcPopupFormBounds(PopupCommonForm.Size);
PopupCommonForm.Location = bounds.Location;
PopupCommonForm.currentEditor = this;
PopupCommonForm.ShowDialog();
return null;
}
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public override int SelectedIndex
{
get { return 0; }
set { }
}
}
}