[Cf. Skills] textbox with read-only but selectable content set on Windows Mobile

Source: Internet
Author: User

This article demonstrates how to set a read-only object, but allows users to select it and set textbox of other attributes. Instead of using the readonly attribute, this article uses another tips.
Keywords
. NET Compact framework, Windows Mobile, Textbox, keypress, C #

The traditional textbox with readonly = true is not easy to modify, but lable does not allow users to select the content above. The keypress cannot be used to type the content. A simple technique is used to implement a textbox that is read-only but other attributes are available.

CodeAs follows:

Public Form1 ()
{
Initializecomponent ();
Textbox1.keypress+ = NewKeypresseventhandler (textbox1_keypress );
}

Void Textbox1_keypress ( Object Sender, keypresseventargs E)
{
E. Handled= True;
}

The running effect is as follows:

Complete example: Click here to download

Enjoy!

Yellow winter

Related Article

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.