forked from hagronnestad/nextion-font-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest1.linq
59 lines (48 loc) · 1.59 KB
/
test1.linq
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
<Query Kind="Statements">
<Reference><RuntimeDirectory>\System.Configuration.dll</Reference>
<Reference><RuntimeDirectory>\System.Design.dll</Reference>
<Reference><RuntimeDirectory>\System.Drawing.Design.dll</Reference>
<Reference><RuntimeDirectory>\System.Web.dll</Reference>
<Reference><RuntimeDirectory>\System.Web.Mobile.dll</Reference>
<Reference><RuntimeDirectory>\System.Web.RegularExpressions.dll</Reference>
<Reference><RuntimeDirectory>\System.Windows.Forms.dll</Reference>
<Namespace>System.Windows.Forms</Namespace>
<Namespace>System.Drawing</Namespace>
<Namespace>System.Drawing.Text</Namespace>
</Query>
var f = new Form();
f.Show();
var p1 = new PictureBox()
{
Location = new Point(0, 0),
BackColor = Color.Red
};
f.Controls.Add(p1);
var p2 = new PictureBox()
{
Location = new Point(0, 100),
BackColor = Color.Red
};
f.Controls.Add(p2);
var font1 = new Font("Arial", 24, GraphicsUnit.Pixel);
var b1 = new Bitmap(24, 24);
var p1g = Graphics.FromImage(b1);
p1g.DrawString(
"a",
font1,
new SolidBrush(Color.Black), 0, 0);
p1.Image = b1;
var font2 = new Font("Arial", 96, GraphicsUnit.Pixel);
var b2 = new Bitmap(96, 96);
var p2g = Graphics.FromImage(b2);
p2g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None;
p2g.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
p2g.DrawString(
"a",
font2,
new SolidBrush(Color.Black), 0, 0);
var b3 = new Bitmap(24, 24);
var p3g = Graphics.FromImage(b3);
p3g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
p3g.DrawImage(b2, 0, 0, 24, 24);
p2.Image = b3;