Microsoft Visual C++ .NET is a powerful language compared
to other .NET enabled languages like C#, VB .NET etc. It is the only language
that supports both managed and unmanaged C++.
Simple WordPad is an application that uses the
control in Windows Forms. The
RichTextBox control can be used to
create, edit, save and open different file formats such as Document files,
RichText format files, Plain text files and DOS based text files, including
those with embedded images.
The main use of
RichTextBox is formatting text, changing color,
and all the operations support by
TextBox. This project uses
CommonDialog controls also. The
Horizontal and Vertical Scrollbars by default. But the
by default displays a vertical scrollbar only.
This project was developed with Microsoft (R) 32-bit C/C++
Standard Compiler Version 13.00.9466 for 80x86 and compiled with the
switch on the command line. This project did not use the
Microsoft .NET IDE.
supports all the
features of the
Control with some new features added. We
can change the font type or font colors independently like Microsoft Word format
embedded with images.
properties are also supported in the
control. The default
. If the
, the text automatically
adjusts with the Horizontal scrollbar. If the property is set to
property is disabled.
The class hierarchy for the
RichTextBox Class is
is derived from the
class thus inheriting all the functionality of the
RichTextBox *m_pRichText = new RichTextBox();
m_pRichText-> Dock = DockStyle::Fill;
m_pRichText ->Font = new System::Drawing::Font(
new FontFamily(S"Times New Roman"), 12.0f );
m_pRichText ->Size = System::Drawing::Size(600, 380);
m_pRichText ->Dock = DockStyle::Fill;
m_pRichText ->TabIndex = 1;
m_pRichText ->Multiline = true;
m_pRichText ->WordWrap =false;
m_pRichText ->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
The above code creates a
object. We then set and
get the properties to the object through the
property is used to initialize the font and the
property is used to set the size of the
control. In our example, the
Style in the object.
For further reading about RichTextBox,
Setting Bullet, Indent and Alignment
Control has a
property like Microsoft Word. When the
, the bullet is
inserted in the selected text. If it is
, the bullet is
removed from the selected text.
Indent property usage procedure is the same as for the
m_pRichText->SelectionBullet = true;
m_pRichText->SelectionIndent = 20;
m_pRichText->SelectionAlignment = HorizontalAlignment::Right;
In our example, if the
property is set
positive the selected whole text will move towards the right and vice versa.
m_pRichText->SelectionIndent = - 20;
property aligns the text or image in
control. The alignment supports three types -
are applicable only for selected (or cursor position) text.
Class provides a
standard set of dialog boxes for operations such as opening and saving files,
setting print options and selecting colors and fonts. In our application we use
ColorDialog *m_pColorDialog = new ColorDialog();
FontDialog *m_pFontDialog = new FontDialog();
OpenFileDialog *m_pFileOpenDialog = new OpenFileDialog();
SaveFileDialog *m_pFileSaveDialog = new SaveDialog();
has it’s own methods and properties but all
property is used to show the particular Common
ColorDialog Commondialog provides service to the user, to
select the Color from the color palette and can select any Custom Color. The
System.Windows.Forms.ColorDialog is derived from the
CommonDialog Base Class
FontDialog CommonDialog allows the user to select from the
list of fonts installed in the Windows operating System. It is also possible to
choose the font color. When font size and font color of the selected text is
changed, the text is changed to the respective color and size. Strikeout and
underline are also used in the same manner.
OpenDialog CommonDialog provides services to open the
Document file, Rich Text File, Text file and DOS based text Files. The
LoadFile property in the
method loads the file to the
SaveFile property saves
document format, text formats, and RichText format files in the
Note: For further reading about, CommonDialog Class,
About the Sample code:
With a simple WordPad application we can create,
edit, open and save the
enabled formats (* .doc, *.txt,
* .rtf). The edit menu is used for normal clipboard operations such as Cut,
Copy, Paste, Select All and Clear operations with special
Redo, Undo operations.
The Options menu is used to change the
Font Style. The
RichTextBox menu has bullet, indent and the alignments for selected
The Managed C++ language is a C++ language to access the .NET
framework directly with
compiler option for C++ programmers.
The Managed C++ is the only .NET-enabled language which support both managed
code and unmanaged code. The disadvantage of C++ is complexity compared to other
.NET enabled languages like C# and VB .NET.
For further reference about Managed C++