12-18windows Form Application Applet Notepad (1)

Source: Internet
Author: User

First, Notepad production (1)

C # combined with forms to make small programs, compared to the previous console application may have to improve a lot, at least the interface seems to be high-profile, but the most important thing is to see whether the functionality of the implementation. Therefore, to realize its practical functions mainly. Use C # today to make a simple Notepad application.

1, first, Notepad mainly includes five modules: file, edit, format, view, Help. Each module below includes its own basic functions, such as: In file, new, open, save, exit, and so on. So be patient with your production.

2. After understanding, use the form to draw the "notepad" model. (very well painted.) )

That's about it.

3, Next, is to realize their functions.

1) file

"1" "New" file: In fact, the new file is equivalent to reopen a new window. As a result, two Notepad windows appear.

"View Code" in the "File"-"new" This click event, directly double-click to enter the Jishiben.cs to edit the operation code . Basic All Click events will have this action, the following is no longer one by one description.

These are the previously imperfect code operations. The following code operation is a well-developed function, and there will be no more than two windows in the case.

"View" When the text box already has the text, click "New", first will pop up the "prompt" window, whether need to save; there are three cases (yes,no,cancel).

1> If "save" is required, the following "save" operation will continue.

2> if not saved, click "No", will restore the blank interface;

3> If you click "Cancel", you still stay on the current page without emptying the text.

"2" Open file, is to reopen the previous action of the file to edit. operation via StreamReader . After that, they will be devoted to explaining.

"View Code"

"3" "Save" file, through StreamWriter operation. Before the file has been manipulated, on the hard disk has this file path, when the text is again edited to save, directly save;

"4" "Save as" file, refers to the first time the file is saved, will appear the file "Save as" dialog box;

"View Code"


The above "open" and "save" action is to open and save the text, when there is already text on the page, but still appear the "Save as" dialog box, rather than save directly, the following code is to solve the problem;

The first step is to define an external variable to receive internal code operations.

"Open" Action:

"Save" Action:

"5" Page Setup

View

"View Code"

In the designer-toolbox-print, you can directly find the control of the page settings, but the control is not available, there is a need for PageSetupDialog "Document" event (PRINTDOCUMENT1).

The page setup is mainly about "printing". So, pay special attention to it.

"6" Printing

"View Effects"

"View Code"

"7" exit (i.e. close text document)

2) Edit

"1" undo (//Get the text length in the textbox, intercept the string from index 0 to the previous bit of the last character to re-assign to TextBox1.Text), cut, copy, paste, delete

"2" Search

"View Code"

【】

"3" replacement

【】

12-18windows Form Application Applet Notepad (1)

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.