/// <summary>
        /// 批量生成二维码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmsItemQRCodeBatchGenerate_Click(object sender, EventArgs e)
        {
            int count = this.dataGridView1.SelectedRows.Count;

            ////选择保存路径
            //string path;
            //FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
            //if (fbd.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            //    return;
            //path = fbd.SelectedPath;
            string path = GlobalUtils.OpenBrowseFolderDlg();

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            for (int i = 0; i != count; ++i)
            {
                string passportNo = dataGridView1.SelectedRows[i].Cells["PassportNo"].Value.ToString();
                string name       = dataGridView1.SelectedRows[i].Cells["EnglishName"].Value.ToString();
                _qrCode.EncodeToPng(passportNo + "|" + name, path + "\\" + passportNo + ".jpg", QRCodeSaveSize.Size165X165);
            }

            MessageBoxEx.Show("成功保存" + count + "条记录二维码.");
        }
示例#2
0
        private void SetQRCodeToPicBox()
        {
            _qrCode.EncodeToPng(_qrinfo, _tmpFileName, QRCodeSaveSize.Size165X165);
            Image image = GlobalUtils.LoadImageFromFileNoBlock(_tmpFileName);

            PicHandler.DrawStringOnPicture(image);
            picQRCode.Image    = image;
            txtQRCodeInfo.Text = _qrinfo;
        }