-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForm2.cs
More file actions
44 lines (36 loc) · 1.19 KB
/
Form2.cs
File metadata and controls
44 lines (36 loc) · 1.19 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
using QRCoder;
namespace Modul_9
{
public partial class Form2 : Form
{
Form1 f1;
public Form2(Form1 frm1)
{
InitializeComponent();
this.f1 = frm1;
}
public static string GenerateQR(string nama, string alamat, string no_hp)
{
string result = "#" + nama + alamat + no_hp;
return result;
}
public static string GenerateQR(string nama, string alamat, string no_hp, out Bitmap bitMap)
{
string text = GenerateQR(nama, alamat, no_hp);
QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode(text, QRCodeGenerator.ECCLevel.Q);
QRCode qrCode = new QRCode(qrCodeData);
bitMap = qrCode.GetGraphic(7);
return text;
}
private void Form2_Load(object sender, EventArgs e)
{
Bitmap qr;
string nama = f1.tbNama.Text;
string alamat = f1.tbAlamat.Text;
string no_hp = f1.tbHp.Text;
lb_qr.Text = GenerateQR(nama, alamat, no_hp, out qr);
pb_qr.BackgroundImage = qr;
}
}
}