One of the conflicts between WPF and IME: Baidu Input method will cause the WPF program to crash!

Source: Internet
Author: User

After studying and using WPF for a while, I felt a little bit about WPF as a less mature framework, not knowing that I was too shallow to learn, or that there were too many bugs in WPF!

>>>>>>> Simulation Scenarios <<<<<<<<<

Customer : Can I use WPF to write a small program for me?

programmer : Oh, what kind of small program?

customer : Once I enter something, you give me a pop-up warning box.

Programmer: so simple?! Is there anything else you want?

Customer : support Various input methods, can not crash!

programmer : Oh, will you accept 500?

customer : Well, not expensive ~ programmer : (Hey, people silly money more)

>>>>>>> programmers start working hard to write code <<<<<<<<<

Programmer Heart said, such a simple program, no XAML, a CS file will be done, look at me!

  1. Using System;
  2. Using System.Windows;
  3. Using System.Windows.Controls;
  4. Namespace BAIDUCRASHESWPF
  5. {
  6. // <summary>
  7. // Interaction logic for App.xaml
  8. // </summary>
  9. public class Program
  10. {
  11. [STAThread]
  12. static void Main (string[] args)
  13. {
  14. TextBox txtbox = new TextBox ();
  15. Txtbox.width = 400;
  16. Txtbox.textchanged + = txtbox_textchanged;
  17. Window Mainwin = new Window ();
  18. Mainwin.windowstartuplocation = Windowstartuplocation.centerscreen;
  19. Mainwin.content = Txtbox;
  20. Mainwin.sizetocontent = Sizetocontent.widthandheight;
  21. Application app = new application ();
  22. App. Shutdownmode = Shutdownmode.onmainwindowclose;
  23. App. Run (Mainwin);
  24. }
  25. static void txtbox_textchanged (object sender, Textchangedeventargs e)
  26. {
  27. MessageBox.Show ("Chinese input Method?") If you use it, the program is going to crash!  ");
  28. }
  29. }
  30. }



OK, run down and try ... Enter Chinese! Hit "China" two words (must be 2 words OH)! Wow, the dialog box is bouncing out! Wow, the program crashed!!! tnnd! After testing, Baidu Input method, Google V2 Input method, QQ, Sogou Input method will cause the program crash. Microsoft Pinyin Input method will not, Google V3 will not.

For specific reasons, see later blog post ~ ~ ~

One of the conflicts between WPF and IME: Baidu Input method will cause the WPF program to crash!

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.