C#打印DM碼
需要準備打印二維碼的庫:DataMatrix.net.dll
DataMatrix.net.dll下載地址:https://sourceforge.net/projects/datamatrixnet/files/rel0.4/rel0.4.4/
文字轉二維碼代碼實現如下:
private void button1_Click(object sender, EventArgs e){try{ string content = "1552458000";Image image = Encode_DM(content, 2, 2);pictureBox1.Image = image;}catch (Exception ex){MessageBox.Show(ex.ToString());}}public Bitmap Encode_DM(string content, int moduleSize = 5, int margin = 5){DmtxImageEncoderOptions opt = new DmtxImageEncoderOptions();opt.ModuleSize = moduleSize;opt.MarginSize = margin;//如果有顯示不全的二維碼,可以適當增大margin值DmtxImageEncoder encoder = new DmtxImageEncoder();Bitmap bm = encoder.EncodeImage(content, opt);return bm;}?
?
?
總結
- 上一篇: 基于matlab人脸识别论文,基于mat
- 下一篇: 毕业设计-医院药品出入库管理系统