1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
#pragma once
#include "Struct.h"
#include "windows.h"
#include <string>
using namespace std;
namespace ftuy
{ 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>
/// Description résumée de Form1
///
/// AVERTISSEMENT*: si vous modifiez le nom de cette classe, vous devrez modifier la
/// propriété 'Nom du fichier de ressources' de l'outil de compilation de ressource managée
/// pour tous les fichiers .resx dont dépend cette classe. Dans le cas contraire,
/// les concepteurs ne pourront pas interagir correctement avec les ressources
/// localisées associées à ce formulaire.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{ public:
Form1()
{ InitializeComponent();
//picturebox1
System::Windows::Forms::PictureBox^ Picture;
Picture = (gcnew System::Windows::Forms::PictureBox());
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(Picture))->BeginInit();
Picture->Name="ordi_1";
Picture->Location = System::Drawing::Point(0, 20);
Picture->TabIndex = 0;
Picture->ImageLocation="C:\\Users\\tmnc0605\\Dossier_Conf\\LogoMoto.bmp";
Controls->Add(Picture);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(Picture))->EndInit();
Picture->MouseDown += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::Picture_MouseDown);
Picture->MouseMove += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::Picture_MouseMove);
Picture->MouseUp += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::Picture_MouseUp);
//picturebox2
System::Windows::Forms::PictureBox^ Picture2;
Picture2 = (gcnew System::Windows::Forms::PictureBox());
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(Picture2))->BeginInit();
Picture2->Name="ordi_2";
Picture2->Location = System::Drawing::Point(0, 100);
Picture2->TabIndex = 1;
Picture2->ImageLocation="C:\\Users\\tmnc0605\\Dossier_Conf\\LogoMoto.bmp";
Controls->Add(Picture2);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(Picture))->EndInit();
Picture2->MouseDown += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::Picture_MouseDown);
Picture2->MouseMove += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::Picture_MouseMove);
Picture2->MouseUp += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::Picture_MouseUp);
}
private: System::Void Picture_MouseMove(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{ PictureBox^ Cible = (PictureBox^)sender;
if(click)
{ Cible->Left+=(e->X)-(x_souris);
Cible->Top+=(e->Y)-(y_souris);
Cible->Location = System::Drawing::Point(Cible->Left, Cible->Top);
}
}
private: System::Void Picture_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{ PictureBox^ Cible = (PictureBox^)sender;
click=true;
x_souris = e->X;
y_souris = e->Y;
}
private: System::Void Picture_MouseUp(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{ click=false;
x_souris = 0;
y_souris = 0;
}
protected:
/// <summary>
/// Nettoyage des ressources utilisées.
/// </summary>
~Form1()
{ if (components)
{ delete components;
}
}
//System::Windows::Forms::ListBox^ listbox;
private:
/// <summary>
/// Variable nécessaire au concepteur.
/// </summary>
System::ComponentModel::Container ^components;
bool click;
int x_souris;
int y_souris;
#pragma region Windows Form Designer generated code
/// <summary>
/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
/// le contenu de cette méthode avec l'éditeur de code.
/// </summary>
void InitializeComponent(void)
{ this->SuspendLayout();
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(284, 262);
this->Name = L"Form1";
this->Text = L"Form1";
this->ResumeLayout(false);
}
#pragma endregion
};
} |
Partager