I recently readLi BoAboutMobile phone photo recognition QR codeOfArticleAnd then download the example from codeproject.Source codeYou may encounter the following debugging problems. Today I will share with you my solutions and solutions.
Problem 1: When debugging the winform platform example, the following prompt is displayed:
Error 'thoughtworks. qrcode. properties. resources' does not contain a definition for 'getresource '.
In fact, change the errors:
Memorystream = new memorystream (byte []) resources. ResourceManager. GetObject (filename ));
You can.
Question 2: Example of debugging WmProgramIn encodeIndexoutofrangeexception in rstempAn exception occurs when the maximum index value is exceeded. It is thrown in rstemp [rsblocknumber] [J] = codewords [I2 ~
I thought it was a program logic error. After comparing the class libraries of the desktop and WM versions, I found that there was no error. Then I finally found a stupid solution:
We noticed that the qrcodeencoder. CS class under the qrcodecancelib project defines:
Code
Internal StaticString data_path= "Qrcode_data";
This lineCodeThe desktop version has been commented out. I guess I want to copy the resource file to the directory of the WM program? Okay, so create a new folder under the qrcodewindowsmobile5 project named
Qrcode_data, and then copy the resource files to this directory.
Then, set the actions to generate these resource files, such:
Okay, then try again, encode ~ Pass!
Question 3: Chinese encoding is garbled.
In fact, this problem is very simple. Take this function in the qrcodeencoder. CS class under the qrcodecancelib project as an example. You need to change the encoding method:
Original Function Code:
Code
Public Virtual Bitmap encode (string content)
{
If (Qrcodeutility. isunicode (content ))
{
Return Encode (content, encoding. Unicode );
}
Else
{
Return Encode (content, encoding. ASCII );
}
}
Code after replacement:
Code
Public Virtual Bitmap encode (string content)
{
If (Qrcodeutility. isunicode (content ))
{
Return Encode (content, encoding. getencoding ( " Gb2312 " ));
}
Else
{
Return Encode (content, encoding. ASCII );
}
}
The corresponding code in the qrcodedecoder. CS class also needs to be modified. In this way, both Chinese and English are supported.
Author: Jack fan (Beginner's blog of. Net CF/. Net)
Source: http://longqi293.cnblogs.com
You are welcome to browse and repost this blog post, but this statement must be retained without the author's consent, and the original article connection is clearly provided on the article page. In the reference article, I will indicate the source of the reference article and respect the copyright of others. If you find that I infringe your copyright, please contact me in time.
For more articles, see [stick] index stickers-mobile development (continuously updating)