forked from tianruoyouxin/tianruoocr_last
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fmflags.cs
215 lines (205 loc) · 7.42 KB
/
Fmflags.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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Threading;
using System.Windows.Forms;
namespace 天若OCR文字识别
{
// Token: 0x02000004 RID: 4
public partial class Fmflags : Form
{
// Token: 0x06000044 RID: 68 RVA: 0x0000236A File Offset: 0x0000056A
public Fmflags()
{
this.InitializeComponent();
}
// Token: 0x1700000B RID: 11
// (get) Token: 0x06000045 RID: 69 RVA: 0x00005EC8 File Offset: 0x000040C8
protected override CreateParams CreateParams
{
get
{
CreateParams createParams = base.CreateParams;
createParams.Style |= 131072;
bool flag = !base.DesignMode;
bool flag2 = flag;
bool flag3 = flag2;
bool flag4 = flag3;
bool flag5 = flag4;
bool flag6 = flag5;
bool flag7 = flag6;
bool flag8 = flag7;
if (flag8)
{
createParams.ExStyle |= 524288;
}
return createParams;
}
}
// Token: 0x06000046 RID: 70 RVA: 0x00005F34 File Offset: 0x00004134
public void SetBits(Bitmap bitmap)
{
bool flag = !Image.IsCanonicalPixelFormat(bitmap.PixelFormat) || !Image.IsAlphaPixelFormat(bitmap.PixelFormat);
bool flag2 = flag;
bool flag3 = flag2;
bool flag4 = flag3;
bool flag5 = flag4;
bool flag6 = flag5;
bool flag7 = flag6;
if (flag7)
{
throw new ApplicationException("图片必须是32位带Alhpa通道的图片。");
}
IntPtr hObj = IntPtr.Zero;
IntPtr dc = HelpWin32.GetDC(IntPtr.Zero);
IntPtr intPtr = IntPtr.Zero;
IntPtr intPtr2 = HelpWin32.CreateCompatibleDC(dc);
try
{
HelpWin32.Point point = new HelpWin32.Point(base.Left, base.Top);
HelpWin32.Size size = new HelpWin32.Size(bitmap.Width, bitmap.Height);
HelpWin32.BLENDFUNCTION blendfunction = default(HelpWin32.BLENDFUNCTION);
HelpWin32.Point point2 = new HelpWin32.Point(0, 0);
intPtr = bitmap.GetHbitmap(Color.FromArgb(0));
hObj = HelpWin32.SelectObject(intPtr2, intPtr);
blendfunction.BlendOp = 0;
blendfunction.SourceConstantAlpha = byte.MaxValue;
blendfunction.AlphaFormat = 1;
blendfunction.BlendFlags = 0;
HelpWin32.UpdateLayeredWindow(base.Handle, dc, ref point, ref size, intPtr2, ref point2, 0, ref blendfunction, 2);
}
finally
{
bool flag8 = intPtr != IntPtr.Zero;
bool flag9 = flag8;
bool flag10 = flag9;
bool flag11 = flag10;
bool flag12 = flag11;
bool flag13 = flag12;
bool flag14 = flag13;
if (flag14)
{
HelpWin32.SelectObject(intPtr2, hObj);
HelpWin32.DeleteObject(intPtr);
}
HelpWin32.ReleaseDC(IntPtr.Zero, dc);
HelpWin32.DeleteDC(intPtr2);
}
}
// Token: 0x06000047 RID: 71 RVA: 0x000060A0 File Offset: 0x000042A0
public void DrawStr(string str)
{
this.宽度 = 50 * str.Length;
base.ClientSize = new Size(this.宽度, 50);
base.Location = new Point((Screen.PrimaryScreen.Bounds.Width - base.Width) / 2, (Screen.PrimaryScreen.WorkingArea.Height - base.Height) / 2 / 3 * 5);
this.bmp = new Bitmap(this.宽度, 50);
this.g = Graphics.FromImage(this.bmp);
this.g.InterpolationMode = InterpolationMode.Bilinear;
this.g.SmoothingMode = SmoothingMode.HighQuality;
this.g.TextRenderingHint = TextRenderingHint.AntiAlias;
this.g.Clear(Color.Transparent);
this.g.FillRectangle(new SolidBrush(Color.FromArgb(1, 255, 255, 255)), base.ClientRectangle);
StringFormat stringFormat = new StringFormat();
stringFormat.Alignment = StringAlignment.Center;
Rectangle r = new Rectangle(0, 3, this.宽度, 50);
this.g.FillRectangle(new SolidBrush(Color.FromArgb(120, Color.Black)), 1, 1, this.宽度 - 2, 48);
this.g.DrawRectangle(new Pen(Color.FromArgb(224, 224, 224)), 2, 2, this.宽度 - 2 - 2, 46);
this.g.DrawString(str, new Font("微软雅黑", 24f / Program.factor), new SolidBrush(Color.FromArgb(255, Color.White)), r, stringFormat);
this.SetBits(this.bmp);
this.g.Dispose();
this.bmp.Dispose();
this.Delay(600u);
base.Hide();
}
// Token: 0x06000048 RID: 72 RVA: 0x00006290 File Offset: 0x00004490
private void Delay(uint ms)
{
uint tickCount = HelpWin32.GetTickCount();
while (HelpWin32.GetTickCount() - tickCount < ms)
{
Thread.Sleep(1);
Application.DoEvents();
}
}
// Token: 0x06000049 RID: 73 RVA: 0x000062C4 File Offset: 0x000044C4
public void DrawStr_update(string str)
{
this.宽度 = 28 * str.Length;
base.ClientSize = new Size(this.宽度, 50);
this.bmp = new Bitmap(this.宽度, 50);
this.g = Graphics.FromImage(this.bmp);
this.g.InterpolationMode = InterpolationMode.Bilinear;
this.g.SmoothingMode = SmoothingMode.HighQuality;
this.g.TextRenderingHint = TextRenderingHint.AntiAlias;
this.g.Clear(Color.Transparent);
this.g.FillRectangle(new SolidBrush(Color.FromArgb(1, 255, 255, 255)), base.ClientRectangle);
StringFormat stringFormat = new StringFormat();
stringFormat.Alignment = StringAlignment.Center;
Rectangle r = new Rectangle(0, 10, this.宽度, 48);
this.g.FillRectangle(new SolidBrush(Color.FromArgb(120, Color.Black)), 1, 1, this.宽度 - 2, 48);
this.g.DrawRectangle(new Pen(Color.FromArgb(224, 224, 224)), 1, 1, this.宽度 - 2, 48);
this.g.DrawString(str, new Font("微软雅黑", 18f), new SolidBrush(Color.FromArgb(255, Color.White)), r, stringFormat);
this.SetBits_update(this.bmp);
this.Delay(2000u);
base.Hide();
}
// Token: 0x0600004A RID: 74 RVA: 0x00006450 File Offset: 0x00004650
public void SetBits_update(Bitmap bitmap)
{
bool flag = !Image.IsCanonicalPixelFormat(bitmap.PixelFormat) || !Image.IsAlphaPixelFormat(bitmap.PixelFormat);
bool flag2 = flag;
bool flag3 = flag2;
bool flag4 = flag3;
bool flag5 = flag4;
bool flag6 = flag5;
bool flag7 = flag6;
if (flag7)
{
throw new ApplicationException("图片必须是32位带Alhpa通道的图片。");
}
IntPtr hObj = IntPtr.Zero;
IntPtr dc = HelpWin32.GetDC(IntPtr.Zero);
IntPtr intPtr = IntPtr.Zero;
IntPtr intPtr2 = HelpWin32.CreateCompatibleDC(dc);
try
{
HelpWin32.Point point = new HelpWin32.Point(Screen.PrimaryScreen.Bounds.Width - base.Width, Screen.PrimaryScreen.WorkingArea.Height - 50);
HelpWin32.Size size = new HelpWin32.Size(bitmap.Width, bitmap.Height);
HelpWin32.BLENDFUNCTION blendfunction = default(HelpWin32.BLENDFUNCTION);
HelpWin32.Point point2 = new HelpWin32.Point(0, 0);
intPtr = bitmap.GetHbitmap(Color.FromArgb(0));
hObj = HelpWin32.SelectObject(intPtr2, intPtr);
blendfunction.BlendOp = 0;
blendfunction.SourceConstantAlpha = byte.MaxValue;
blendfunction.AlphaFormat = 1;
blendfunction.BlendFlags = 0;
HelpWin32.UpdateLayeredWindow(base.Handle, dc, ref point, ref size, intPtr2, ref point2, 0, ref blendfunction, 2);
}
finally
{
bool flag8 = intPtr != IntPtr.Zero;
bool flag9 = flag8;
bool flag10 = flag9;
bool flag11 = flag10;
bool flag12 = flag11;
bool flag13 = flag12;
bool flag14 = flag13;
if (flag14)
{
HelpWin32.SelectObject(intPtr2, hObj);
HelpWin32.DeleteObject(intPtr);
}
HelpWin32.ReleaseDC(IntPtr.Zero, dc);
HelpWin32.DeleteDC(intPtr2);
}
}
// Token: 0x04000039 RID: 57
private Bitmap bmp;
// Token: 0x0400003A RID: 58
private Graphics g;
// Token: 0x0400003B RID: 59
public int 宽度;
}
}