|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Services
Chapters
Feature Zones
|
IntroductionMicrosoft 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 The main use of Note:This project was developed with Microsoft (R) 32-bit C/C++ Standard Compiler Version 13.00.9466 for 80x86 and compiled with the/CLR switch on the command line. This project did not use the
Microsoft .NET IDE.
![]() RichTextBox ControlTheRichTextBox supports all the
features of the TextBox Control with some new features added. We
can change the font type or font colors independently like Microsoft Word format
embedded with images. WordWrap properties are also supported in the
RichTextBox control. The default WordWrap property in
the RichTextBox Control is true. If the
WordWrap Property is true, the text automatically
adjusts with the Horizontal scrollbar. If the property is set to
false, the WordWrap property is disabled.
The class hierarchy for the System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.TextBoxBase
System.Windows.Forms.RichTextBox
The RichTextBox is derived from the TextBox base
class thus inheriting all the functionality of the TextBox Class. 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 RichTextBox object. We then set and
get the properties to the object through the m_pRichText pointer.
The Font property is used to initialize the font and the
Size property is used to set the size of the
RichTextBox control. In our example, the Border style
is Fixed3D Style in the object.
For further reading about RichTextBox, Setting Bullet, Indent and AlignmentTheRichTextBox
Control has a Bullet property like Microsoft Word. When the
SelectionBullet property is true, the bullet is
inserted in the selected text. If it is false, the bullet is
removed from the selected text.
The //Set selected text as bullet format
m_pRichText->SelectionBullet = true;
// Set selected text as Indent
m_pRichText->SelectionIndent = 20;
// Alignment of RichTextBox
m_pRichText->SelectionAlignment = HorizontalAlignment::Right;
In our example, if the SelectionIndent property is set
positive the selected whole text will move towards the right and vice versa.
For example, // Text moves to left
m_pRichText->SelectionIndent = - 20;
The SelectionAlignment property aligns the text or image in
the RichTextBox control. The alignment supports three types -
Left, Right or Center. These
Bullet, Indent and Alignment properties
are applicable only for selected (or cursor position) text.
CommonDialog ClassesTheCommonDialog 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
four CommonDialog Classes. // Opens the common colordialog
ColorDialog *m_pColorDialog = new ColorDialog();
// Opens the common Font Dialog
FontDialog *m_pFontDialog = new FontDialog();
// Opens the Commom OpenFileDialog
OpenFileDialog *m_pFileOpenDialog = new OpenFileDialog();
//Opens the Common FileSaveDialog
SaveFileDialog *m_pFileSaveDialog = new SaveDialog();
Each CommonDialog has it’s own methods and properties but all
the CommonDialog controls support ShowDialog property.
The ShowDialog property is used to show the particular Common
Dialog control.
The The The Note: For further reading about, CommonDialog Class, About the Sample code:With a simple WordPad application we can create, edit, open and save theRichTextBox 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
RichTextBox Redo, Undo operations.
The Options menu is used to change the SummaryThe Managed C++ language is a C++ language to access the .NET framework directly with/CLR 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++ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmex/html/vcconMCOverview.asp
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||