Bitcoin_QR_Popup.Form1.draw_qr C# (CSharp) Method

draw_qr() private method

private draw_qr ( string qr_value ) : void
qr_value string
return void
        private void draw_qr(string qr_value)
        {
            QrEncoder qrEncoder = new QrEncoder(ErrorCorrectionLevel.H);
            QrCode qrCode = qrEncoder.Encode(qr_value);

            int padding = 2;
            double module_size = (double)(pictureBox_qr.Width) / (double)(qrCode.Matrix.Width + 2*padding);

            int moduleSizeInPixels = (int)Math.Floor(module_size);
            Renderer renderer = new Renderer(moduleSizeInPixels, Brushes.Black, Brushes.White);
            renderer.QuietZoneModules = (QuietZoneModules)padding;

            Size qrCodeSize = renderer.Measure(qrCode.Matrix.Width);
            reset_qr_display();
            using (Graphics graphics = Graphics.FromImage(pictureBox_qr.Image))
            {
                renderer.Draw(graphics, qrCode.Matrix);
            }

            pictureBox_qr.Refresh();
        }