Posted by rand0m on Wed 20th Dec 06:18
download | new post
- // tests.cpp : main project file.
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- #pragma comment( lib, "User32.lib" )
- #include "Windows.h"
- #include "Form1.h"
- #include "form2.h"
- using namespace tests;
- [STAThreadAttribute]
- int main(array<System::String ^> ^args)
- {
- // Enabling Windows XP visual effects before any controls are created
- Application::EnableVisualStyles();
- Application::SetCompatibleTextRenderingDefault(false);
- // Create the main window and run it
- Application::Run(gcnew Form1());
- /*
- bool done=0; Form1 f; f.Show();
- while(!done){ if((bool)GetAsyncKeyState(VK_ESCAPE)){ MessageBox::Show("Click!"); done=true; } }
- */
- return 0;
- }
- ///// Form1.h
- #include "form2.h"
- namespace tests {
- 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;
- private: System::Windows::Forms::PictureBox^ pictureBox1;
- 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->button1 = (gcnew System::Windows::Forms::Button());
- this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit();
- this->SuspendLayout();
- //
- // button1
- //
- this->button1->Location = System::Drawing::Point(12, 448);
- this->button1->Name = L"button1";
- this->button1->Size = System::Drawing::Size(128, 59);
- this->button1->TabIndex = 0;
- this->button1->Text = L"screenshot";
- this->button1->UseVisualStyleBackColor = true;
- this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
- //
- // pictureBox1
- //
- this->pictureBox1->ImageLocation = L"System.Drawing.screenshot";
- this->pictureBox1->Location = System::Drawing::Point(12, 12);
- this->pictureBox1->Name = L"pictureBox1";
- this->pictureBox1->Size = System::Drawing::Size(568, 430);
- this->pictureBox1->TabIndex = 1;
- this->pictureBox1->TabStop = false;
- this->pictureBox1->Click += gcnew System::EventHandler(this, &Form1::pictureBox1_Click);
- //
- // Form1
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->ClientSize = System::Drawing::Size(592, 519);
- this->Controls->Add(this->pictureBox1);
- this->Controls->Add(this->button1);
- this->Name = L"Form1";
- this->Text = L"Form1";
- this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->EndInit();
- this->ResumeLayout(false);
- }
- #pragma endregion
- private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
- tests::form2 f; f.Show();
- }
- private: System::Void pictureBox1_Click(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
- }
- };
- }
- /// form2.h is same as Form1.h
Submit a correction or amendment below. (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.