I am a gamer, I play World of Warcraft, so I wanted to make a Windows Form Application first instead of making a Win32 Application because the forms seemed easier to me. What I am trying to do is make my form have 2 buttons. 1 that opens World of Warcraft, and 1 that closes the form.
Here is my code...
#pragma once
namespace WoW {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
///
/// 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.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
private: System::Windows::Forms::Button^ button2;
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)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// button1
//
this->button1->Font = (gcnew System::Drawing::Font(L"Footlight MT Light", 11.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->button1->Location = System::Drawing::Point(179, 107);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(81, 30);
this->button1->TabIndex = 0;
this->button1->Text = L"Play WoW";
this->button1->UseVisualStyleBackColor = true;
//
// button2
//
this->button2->Font = (gcnew System::Drawing::Font(L"Footlight MT Light", 11.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->button2->Location = System::Drawing::Point(266, 107);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(81, 30);
this->button2->TabIndex = 1;
this->button2->Text = L"Get a Life";
this->button2->UseVisualStyleBackColor = true;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"$this.BackgroundImage")));
this->ClientSize = System::Drawing::Size(359, 140);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->MaximizeBox = false;
this->MaximumSize = System::Drawing::Size(375, 176);
this->MinimumSize = System::Drawing::Size(375, 176);
this->Name = L"Form1";
this->SizeGripStyle = System::Windows::Forms::SizeGripStyle::Hide;
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
this->ResumeLayout(false);
}
#pragma endregion
};
}
The cool thing about Microsoft Visual C++, is that it will give you a list of possible functions when editing the code.
All I can get is
this->button1->onclick =
Then I am not really sure what to put next.
Can anyone help?
Thanks in advanced!
This post has been edited by Sarcalogos: 12 October 2008 - 11:19 PM

New Topic/Question
Reply



MultiQuote





|