About small problems and solutions in the operation of WM version of "mobile phone photo recognition QR code)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.