2010년 3월 8일 월요일

Word Processing with an Extended Rich Text Box Control

http://www.c-sharpcorner.com/uploadfile/scottlysle/wordprocessor02042007234628pm/wordprocessor.aspx


Introduction: 

This article describes an easy approach to building a simple word processor around an extended version of the Rich Text Box (RTB) control; Microsoft has made available an extended version of the RTB control that greatly eases the requirements for printing the control's text or RTF content. This article and the sample application will use this extended version of the RTF control to demonstrate the following word processor related functions:

  • Opening Text, RTF, HTML, or other text files into a RTB control
  • Saving Text, RTF, HTML, or other text files from an RTB control
  • Implementation of the Page Setup dialog control
  • Implementation of the Print Preview dialog control
  • Implementation of the Print dialog control
  • Setting font properties on selected text or RTF within the RTB control
  • Searching for and highlighting text contained within the RTB control
  • Searching for and replacing text contained within the RTB control
  • Adding Indentation to sections of an RTB's content
  • Adding Bullets to sections of an RTB's content
  • Implementing Undo/Redo within an RTB
  • Implementing Select All, Cut, Copy, and Paste in an RTB control
  • Embedding Images into an RTB control
  • Setting page and font colors
  • Implementing Alignment options in an RTB control

Whilst this project will not lead you to drop MS Word, it is a decent little word processor and to that end, you may find a use for it. I have always kept one of these on hand and have frequently tailored them to do things like provide a custom tool for viewing reports, error logs, and things of that nature when I wanted to integrate that feature into a product so that I could use it in lieu of doing something like shelling out a text file into Notepad. Doing so allows me to control the appearance of the application, the caption in the title bar of the form, etc.

Figure 1:  The Editor Application in Use


댓글 없음:

댓글 쓰기