I am following a tutorial for Windows Forms (Visual Studio 2005, sorry its all I've got at uni). http://msdn.microsoft.com/en-us/library/ms235628(v=VS.80).aspx
I am on Add a Custom Property to the Control
It is asking me to:
Place the cursor after the colon of the first public scope indicator at the top of the clickcounterControl.h file, press Enter, then type the following:
No matter where I put the cursor I can't seem to get it right. Can someone tell me where it means.
The code I currently have is:
#pragma once
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
namespace clickcounter {
/// <summary>
/// Summary for clickcounterControl
/// </summary>
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
public ref class clickcounterControl : public System::Windows::Forms::UserControl
{
public:
clickcounterControl(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~clickcounterControl()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Label^ label1;
protected:
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container^ components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->label1 = (gcnew System::Windows::Forms::Label());
this->SuspendLayout();
//
// label1
//
this->label1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;
this->label1->Location = System::Drawing::Point(35, 41);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(30, 20);
this->label1->TabIndex = 0;
this->label1->Text = L"0";
this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
this->label1->Click += gcnew System::EventHandler(this, &clickcounterControl::label1_Click);
//
// clickcounterControl
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
this->Controls->Add(this->label1);
this->Name = L"clickcounterControl";
this->Size = System::Drawing::Size(96, 96);
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) {
int temp = System::Int32::Parse(label1->Text);
temp++;
label1->Text = temp.ToString();
}
};
}