microsoft forms怎么把问题形成二维码形式?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了microsoft forms怎么把问题形成二维码形式?相关的知识,希望对你有一定的参考价值。
首先先装一个 ThoughtWorks.QRCode.dll;(百度下载,然后点添加引用,里面有个浏览,再添加)然后加using 语句
using System.Windows.Forms;
using ThoughtWorks;
using ThoughtWorks.QRCode;
using ThoughtWorks.QRCode.Codec;
using ThoughtWorks.QRCode.Codec.Data;
然后写方法
private void button1_Click(object sender, EventArgs e)
create_two(this.textBox1.Text);
//create_two(this.textBox2.Text);
private void create_two(string nr)
Bitmap bt;
string enCodeString = nr;
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
bt = qrCodeEncoder.Encode(enCodeString, Encoding.UTF8);
string filename = string.Format(DateTime.Now.ToString(), "yyyymmddhhmmss")
+ ".jpg";
filename = filename.Replace(" ", "");
filename = filename.Replace(":", "");
filename = filename.Replace("-", "");
filename = filename.Replace(".", "");
bt.Save(".image.Png", System.Drawing.Imaging.ImageFormat.Png);
pictureBox1.Image = Image.FromFile(@".image.Png");
搞定啦~~~ 参考技术A 首先先装一个 ThoughtWorks.QRCode.dll;(百度下载,然后点添加引用,里面有个浏览,再添加)
然后加using 语句
using System.Windows.Forms;
using ThoughtWorks;
using ThoughtWorks.QRCode;
using ThoughtWorks.QRCode.Codec;
using ThoughtWorks.QRCode.Codec.Data;
然后写方法
private void button1_Click(object sender, EventArgs e)
create_two(this.textBox1.Text);
//create_two(this.textBox2.Text);
private void create_two(string nr)
Bitmap bt;
string enCodeString = nr;
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
bt = qrCodeEncoder.Encode(enCodeString, Encoding.UTF8);
string filename = string.Format(DateTime.Now.ToString(), "yyyymmddhhmmss")
+ ".jpg";
filename = filename.Replace(" ", "");
filename = filename.Replace(":", "");
filename = filename.Replace("-", "");
filename = filename.Replace(".", "");
bt.Save(".image.Png", System.Drawing.Imaging.ImageFormat.Png);
pictureBox1.Image = Image.FromFile(@".image.Png");
搞定啦~~~
java http post 怎么设置 raw格式
调试微信推广支持中二维码生成api的接口,使用chrome浏览器的postman插件,post请求时有一个选项是form-data,或者raw,使用raw可以请求成功,from-data不知道怎么组装key和value所以一直失败。非常不明白raw是什么意思,google百度都没有相关的解释。后来研究发现,其实raw方式使用的是纯字符串的数据上传方式,所以在POST之前,可能需要手工的把一些json/text/xml格式的数据转换成字符串,是一种post原始请求,区别于form-data这种常用的key-value方式。public static String result; public static void httpTest() throws ClientProtocolException, IOException String token = "R5amyr6NyXCtWdScmNiuvVwBCJztfByZDUGaE2V0NwOUheW4XYlvUusYkrViTYt584RgcyXRhjxAJZG3rFlPLg"; String url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + token; String json = ""action_name":"QR_LIMIT_SCENE","action_info":"scene":"scene_id":234"; HttpClient httpClient = new DefaultHttpClient(); HttpPost post = new HttpPost(url); StringEntity postingString = new StringEntity(json);// json传递 post.setEntity(postingString); post.setHeader("Content-type", "application/json"); HttpResponse response = httpClient.execute(post); String content = EntityUtils.toString(response.getEntity()); // Log.i("test",content); System.out.println(content); result = content;
以上代码中需要导入
import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils;
Android中自带org.apache.http相关库文件,所以可以快捷键(ctrl+shift+o)一次导入成功。 参考技术A public static String result;
public static void httpTest() throws ClientProtocolException, IOException
String token = "R5amyr6NyXCtWdScmNiuvVwBCJztfByZDUGaE2V0NwOUheW4XYlvUusYkrViTYt584RgcyXRhjxAJZG3rFlPLg";
String url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token="
+ token;
String json = "\"action_name\":\"QR_LIMIT_SCENE\",\"action_info\":\"scene\":\"scene_id\":234";
HttpClient httpClient = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
StringEntity postingString = new StringEntity(json);// json传递
post.setEntity(postingString);
post.setHeader("Content-type", "application/json");
HttpResponse response = httpClient.execute(post);
String content = EntityUtils.toString(response.getEntity());
// Log.i("test",content);
System.out.println(content);
result = content;
以上是关于microsoft forms怎么把问题形成二维码形式?的主要内容,如果未能解决你的问题,请参考以下文章