forked from ahyahy/OneScriptForms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFontDialog.cs
More file actions
133 lines (111 loc) · 3.64 KB
/
FontDialog.cs
File metadata and controls
133 lines (111 loc) · 3.64 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
using ScriptEngine.Machine.Contexts;
using ScriptEngine.Machine;
using System.Threading;
namespace osf
{
public class FontDialogEx : System.Windows.Forms.FontDialog
{
public osf.FontDialog M_Object;
}
public class FontDialog : CommonDialog
{
public ClFontDialog dll_obj;
public FontDialogEx M_FontDialog;
public FontDialog()
{
M_FontDialog = new FontDialogEx();
M_FontDialog.M_Object = this;
base.M_CommonDialog = M_FontDialog;
}
public FontDialog(System.Windows.Forms.FontDialog p1)
{
M_FontDialog = (FontDialogEx)p1;
M_FontDialog.M_Object = this;
base.M_CommonDialog = M_FontDialog;
}
public FontDialog(osf.FontDialog p1)
{
M_FontDialog = p1.M_FontDialog;
M_FontDialog.M_Object = this;
base.M_CommonDialog = M_FontDialog;
}
//Свойства============================================================
public osf.Color Color
{
get { return new Color(M_FontDialog.Color); }
set { M_FontDialog.Color = value.M_Color; }
}
public osf.Font Font
{
get { return new Font(M_FontDialog.Font); }
set { M_FontDialog.Font = value.M_Font; }
}
public bool ShowColor
{
get { return M_FontDialog.ShowColor; }
set { M_FontDialog.ShowColor = value; }
}
//Методы============================================================
}
[ContextClass ("КлДиалогВыбораШрифта", "ClFontDialog")]
public class ClFontDialog : AutoContext<ClFontDialog>
{
public ClFontDialog()
{
FontDialog FontDialog1 = new FontDialog();
FontDialog1.dll_obj = this;
Base_obj = FontDialog1;
}
public ClFontDialog(FontDialog p1)
{
FontDialog FontDialog1 = p1;
FontDialog1.dll_obj = this;
Base_obj = FontDialog1;
}
public FontDialog Base_obj;
//Свойства============================================================
[ContextProperty("Тип", "Type")]
public ClType Type
{
get { return new ClType(this); }
}
[ContextProperty("Цвет", "Color")]
public ClColor Color
{
get { return (ClColor)OneScriptForms.RevertObj(Base_obj.Color); }
set { Base_obj.Color = value.Base_obj; }
}
[ContextProperty("Шрифт", "Font")]
public ClFont Font
{
get { return (ClFont)OneScriptForms.RevertObj(Base_obj.Font); }
set
{
Base_obj.Font = value.Base_obj;
Base_obj.Font.dll_obj = value;
}
}
//Методы============================================================
[ContextMethod("Освободить", "Dispose")]
public void Dispose()
{
Base_obj.Dispose();
}
[ContextMethod("ПоказатьДиалог", "ShowDialog")]
public IValue ShowDialog()
{
int Res1 = 0;
var thread = new Thread(() =>
{
Base_obj.ShowColor = true;
Res1 = (int)Base_obj.ShowDialog();
}
);
thread.IsBackground = true;
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
return ValueFactory.Create(Res1);
}
}
}