forked from ahyahy/OneScriptForms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIcon.cs
More file actions
134 lines (115 loc) · 3.3 KB
/
Icon.cs
File metadata and controls
134 lines (115 loc) · 3.3 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
134
using System;
using ScriptEngine.Machine.Contexts;
namespace osf
{
public class Icon
{
public ClIcon dll_obj;
public System.Drawing.Icon M_Icon;
public Icon(Bitmap bitmap)
{
M_Icon = System.Drawing.Icon.FromHandle(((System.Drawing.Bitmap)bitmap.M_Bitmap).GetHicon());
OneScriptForms.AddToHashtable(M_Icon, this);
}
public Icon(osf.Icon p1)
{
M_Icon = p1.M_Icon;
OneScriptForms.AddToHashtable(M_Icon, this);
}
public Icon(string p1)
{
M_Icon = null;
try
{
System.Drawing.Bitmap Bitmap = new System.Drawing.Bitmap((System.IO.Stream)new System.IO.MemoryStream(Convert.FromBase64String(p1)));
IntPtr Hicon = Bitmap.GetHicon();
System.Drawing.Icon Icon1 = System.Drawing.Icon.FromHandle(Hicon);
M_Icon = Icon1;
}
catch
{
}
try
{
M_Icon = new System.Drawing.Icon((System.IO.Stream)new System.IO.MemoryStream(Convert.FromBase64String(p1)));
}
catch
{
}
if (M_Icon == null)
{
M_Icon = new System.Drawing.Icon(p1);
}
OneScriptForms.AddToHashtable(M_Icon, this);
}
public Icon(string p1, int p2)
{
M_Icon = ExtractIconClass.GetIconFromExeDll(p2, p1);
OneScriptForms.AddToHashtable(M_Icon, this);
}
public Icon(System.Drawing.Icon p1)
{
M_Icon = p1;
OneScriptForms.AddToHashtable(M_Icon, this);
}
public int Height
{
get { return M_Icon.Height; }
}
public osf.Size Size
{
get { return new Size(M_Icon.Size); }
}
public int Width
{
get { return M_Icon.Width; }
}
public osf.Bitmap ToBitmap()
{
return new Bitmap(M_Icon.ToBitmap());
}
}
[ContextClass ("КлЗначок", "ClIcon")]
public class ClIcon : AutoContext<ClIcon>
{
public ClIcon(string p1)
{
Icon Icon1 = new Icon(p1);
Icon1.dll_obj = this;
Base_obj = Icon1;
}
public ClIcon(string p1, int p2)
{
Icon Icon1 = new Icon(p1, p2);
Icon1.dll_obj = this;
Base_obj = Icon1;
}
public ClIcon(Icon p1)
{
Icon Icon1 = p1;
Icon1.dll_obj = this;
Base_obj = Icon1;
}
public Icon Base_obj;
[ContextProperty("Высота", "Height")]
public int Height
{
get { return Base_obj.Height; }
}
[ContextProperty("Размер", "Size")]
public ClSize Size
{
get { return (ClSize)OneScriptForms.RevertObj(Base_obj.Size); }
}
[ContextProperty("Ширина", "Width")]
public int Width
{
get { return Base_obj.Width; }
}
[ContextMethod("ВКартинку", "ToBitmap")]
public ClBitmap ToBitmap()
{
return new ClBitmap(Base_obj.ToBitmap());
}
}
}