Building a Managed .NET Framework Application (5)

December 11, 2009

Listing 3.2 Creating the Form
1: #include “stdafx.h”
2: #include “hellonetform.h”
3: #include
4:
5: #using
6: CHelloNETForm::CHelloNETForm(void)
7: : m_pbtnMessage(NULL)
8: , m_pbtnDone(NULL)
9: , m_pstMessage(NULL)
10: , m_pComponents(NULL)
11: {
12: m_pComponents = new System::ComponentModel::Container();
13:
14: // Initialize the Form
15: InitForm();
16: }
17:
18: CHelloNETForm::~CHelloNETForm()
19: {
20: }
21:
22: void CHelloNETForm::InitForm()
23: {
24:
25: // Allocate the controls
26: m_pbtnMessage = new Button();
27: m_pbtnDone = new Button();
28: m_pstMessage = new Label();
29:
30: SuspendLayout();
31:
32: // Initialize all control properties
33: //
34: // Message Button
35: //
36: m_pbtnMessage->Location = System::Drawing::Point(240, 8);
37: m_pbtnMessage->Name = “Message”;
38: m_pbtnMessage->TabIndex = 0;
39: m_pbtnMessage->Text = “Message”;
40: m_pbtnMessage->add_Click(
41: new System::EventHandler( this, &CHelloNETForm::OnMessageClick ) );
42:
43: //
44: // Done Button
45: //

Taken From: SAMS-Tech Yourself MS Visual C++.NET in 24 Hours

Leave a Reply