using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Runtime.InteropServices; namespace EssaiLib { public class frmEssais : System.Windows.Forms.Form { [DllImport("LibCpp.dll", EntryPoint = "Addition", CallingConvention = CallingConvention.Cdecl)] public static extern int Addition( int operandeG, int operandeD ); [DllImport("LibCpp.dll", EntryPoint = "Concatene", CallingConvention = CallingConvention.Cdecl)] public static extern string Concatene( string chaineA, string chaineB ); private System.Windows.Forms.Label lblInvite; private System.Windows.Forms.Label lblOperandeG; private System.Windows.Forms.TextBox txtOperandeG; private System.Windows.Forms.Label lblOperandeD; private System.Windows.Forms.TextBox txtOperandeD; private System.Windows.Forms.Button cmdMutiplie; private System.Windows.Forms.Label lblResultatEntier; private System.Windows.Forms.GroupBox grpEntiers; private System.Windows.Forms.GroupBox grpChaines; private System.Windows.Forms.Label lblChaineB; private System.Windows.Forms.TextBox txtChaineB; private System.Windows.Forms.Label lblResultatChaine; private System.Windows.Forms.Button cmdConcatenation; private System.Windows.Forms.TextBox txtChaineA; private System.Windows.Forms.Label lblChaine; private System.Windows.Forms.Label lblChaineA; private System.ComponentModel.Container components = null; public frmEssais() { InitializeComponent(); } protected override void Dispose( bool disposing ) { if( disposing ) { if( components != null ) { components.Dispose(); } } base.Dispose( disposing ); } #region Code généré par le Concepteur Windows Form /// <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> private void InitializeComponent() { this.lblInvite = new System.Windows.Forms.Label(); this.lblResultatEntier = new System.Windows.Forms.Label(); this.lblOperandeG = new System.Windows.Forms.Label(); this.txtOperandeG = new System.Windows.Forms.TextBox(); this.lblOperandeD = new System.Windows.Forms.Label(); this.txtOperandeD = new System.Windows.Forms.TextBox(); this.cmdMutiplie = new System.Windows.Forms.Button(); this.grpEntiers = new System.Windows.Forms.GroupBox(); this.grpChaines = new System.Windows.Forms.GroupBox(); this.lblChaineB = new System.Windows.Forms.Label(); this.txtChaineB = new System.Windows.Forms.TextBox(); this.lblResultatChaine = new System.Windows.Forms.Label(); this.cmdConcatenation = new System.Windows.Forms.Button(); this.txtChaineA = new System.Windows.Forms.TextBox(); this.lblChaine = new System.Windows.Forms.Label(); this.lblChaineA = new System.Windows.Forms.Label(); this.grpEntiers.SuspendLayout(); this.grpChaines.SuspendLayout(); this.SuspendLayout(); // // lblInvite // this.lblInvite.Location = new System.Drawing.Point(8, 128); this.lblInvite.Name = "lblInvite"; this.lblInvite.Size = new System.Drawing.Size(120, 24); this.lblInvite.TabIndex = 0; this.lblInvite.Text = "Retour de la fonction :"; // // lblResultatEntier // this.lblResultatEntier.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.lblResultatEntier.Location = new System.Drawing.Point(136, 128); this.lblResultatEntier.Name = "lblResultatEntier"; this.lblResultatEntier.Size = new System.Drawing.Size(152, 23); this.lblResultatEntier.TabIndex = 1; // // lblOperandeG // this.lblOperandeG.Location = new System.Drawing.Point(8, 24); this.lblOperandeG.Name = "lblOperandeG"; this.lblOperandeG.Size = new System.Drawing.Size(112, 23); this.lblOperandeG.TabIndex = 2; this.lblOperandeG.Text = "opérande Gauche :"; // // txtOperandeG // this.txtOperandeG.Location = new System.Drawing.Point(128, 24); this.txtOperandeG.Name = "txtOperandeG"; this.txtOperandeG.Size = new System.Drawing.Size(160, 20); this.txtOperandeG.TabIndex = 3; this.txtOperandeG.Text = ""; // // lblOperandeD // this.lblOperandeD.Location = new System.Drawing.Point(8, 48); this.lblOperandeD.Name = "lblOperandeD"; this.lblOperandeD.Size = new System.Drawing.Size(112, 23); this.lblOperandeD.TabIndex = 4; this.lblOperandeD.Text = "opérande Droit :"; // // txtOperandeD // this.txtOperandeD.Location = new System.Drawing.Point(128, 48); this.txtOperandeD.Name = "txtOperandeD"; this.txtOperandeD.Size = new System.Drawing.Size(160, 20); this.txtOperandeD.TabIndex = 5; this.txtOperandeD.Text = ""; // // cmdMutiplie // this.cmdMutiplie.Location = new System.Drawing.Point(80, 88); this.cmdMutiplie.Name = "cmdMutiplie"; this.cmdMutiplie.Size = new System.Drawing.Size(136, 23); this.cmdMutiplie.TabIndex = 6; this.cmdMutiplie.Text = "Multiplication"; this.cmdMutiplie.Click += new System.EventHandler(this.cmdMutiplie_Click); // // grpEntiers // this.grpEntiers.Controls.Add(this.lblOperandeD); this.grpEntiers.Controls.Add(this.txtOperandeD); this.grpEntiers.Controls.Add(this.lblResultatEntier); this.grpEntiers.Controls.Add(this.cmdMutiplie); this.grpEntiers.Controls.Add(this.txtOperandeG); this.grpEntiers.Controls.Add(this.lblInvite); this.grpEntiers.Controls.Add(this.lblOperandeG); this.grpEntiers.Location = new System.Drawing.Point(8, 8); this.grpEntiers.Name = "grpEntiers"; this.grpEntiers.Size = new System.Drawing.Size(304, 160); this.grpEntiers.TabIndex = 7; this.grpEntiers.TabStop = false; this.grpEntiers.Text = "Nombres entiers sur 32 bits"; // // grpChaines // this.grpChaines.Controls.Add(this.lblChaineB); this.grpChaines.Controls.Add(this.txtChaineB); this.grpChaines.Controls.Add(this.lblResultatChaine); this.grpChaines.Controls.Add(this.cmdConcatenation); this.grpChaines.Controls.Add(this.txtChaineA); this.grpChaines.Controls.Add(this.lblChaine); this.grpChaines.Controls.Add(this.lblChaineA); this.grpChaines.Location = new System.Drawing.Point(8, 184); this.grpChaines.Name = "grpChaines"; this.grpChaines.Size = new System.Drawing.Size(304, 216); this.grpChaines.TabIndex = 8; this.grpChaines.TabStop = false; this.grpChaines.Text = "Chaines de caractères"; // // lblChaineB // this.lblChaineB.Location = new System.Drawing.Point(8, 48); this.lblChaineB.Name = "lblChaineB"; this.lblChaineB.Size = new System.Drawing.Size(64, 23); this.lblChaineB.TabIndex = 4; this.lblChaineB.Text = "Chaine B :"; // // txtChaineB // this.txtChaineB.Location = new System.Drawing.Point(72, 48); this.txtChaineB.Name = "txtChaineB"; this.txtChaineB.Size = new System.Drawing.Size(216, 20); this.txtChaineB.TabIndex = 5; this.txtChaineB.Text = ""; // // lblResultatChaine // this.lblResultatChaine.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.lblResultatChaine.Location = new System.Drawing.Point(8, 152); this.lblResultatChaine.Name = "lblResultatChaine"; this.lblResultatChaine.Size = new System.Drawing.Size(280, 48); this.lblResultatChaine.TabIndex = 1; // // cmdConcatenation // this.cmdConcatenation.Location = new System.Drawing.Point(80, 88); this.cmdConcatenation.Name = "cmdConcatenation"; this.cmdConcatenation.Size = new System.Drawing.Size(136, 23); this.cmdConcatenation.TabIndex = 6; this.cmdConcatenation.Text = "Concaténation"; this.cmdConcatenation.Click += new System.EventHandler(this.cmdConcatenation_Click); // // txtChaineA // this.txtChaineA.Location = new System.Drawing.Point(72, 24); this.txtChaineA.Name = "txtChaineA"; this.txtChaineA.Size = new System.Drawing.Size(216, 20); this.txtChaineA.TabIndex = 3; this.txtChaineA.Text = ""; // // lblChaine // this.lblChaine.Location = new System.Drawing.Point(8, 128); this.lblChaine.Name = "lblChaine"; this.lblChaine.Size = new System.Drawing.Size(120, 24); this.lblChaine.TabIndex = 0; this.lblChaine.Text = "Retour de la fonction :"; // // lblChaineA // this.lblChaineA.Location = new System.Drawing.Point(8, 24); this.lblChaineA.Name = "lblChaineA"; this.lblChaineA.Size = new System.Drawing.Size(64, 23); this.lblChaineA.TabIndex = 2; this.lblChaineA.Text = "Chaine A :"; // // frmEssais // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(322, 410); this.Controls.Add(this.grpEntiers); this.Controls.Add(this.grpChaines); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.Name = "frmEssais"; this.Text = "Essai Librairies"; this.grpEntiers.ResumeLayout(false); this.grpChaines.ResumeLayout(false); this.ResumeLayout(false); } #endregion [STAThread] static void Main() { Application.Run( new frmEssais() ); } private void cmdMutiplie_Click( object sender, System.EventArgs e ) { lblResultatEntier.Text = (Addition(Int32.Parse(txtOperandeG.Text), Int32.Parse(txtOperandeD.Text))).ToString(); } private void cmdConcatenation_Click( object sender, System.EventArgs e ) { lblResultatChaine.Text = Concatene(txtChaineA.Text, txtChaineB.Text); } } }