Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionusing System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Threading; namespace CenzubIHM { /// <summary> /// Summary description for Form1. /// </summary> public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.PictureBox pictureBox3; private System.Windows.Forms.PictureBox pictureBox4; private System.Windows.Forms.Button button1; public string str1="lol"; public string str2="i"; public string str3="lol"; public System.Windows.Forms.TextBox textBox1; public System.Windows.Forms.TextBox textBox2; public System.Windows.Forms.TextBox textBox3; public System.Windows.Forms.PictureBox pictureBox5; public System.Windows.Forms.PictureBox pictureBox6; public System.Windows.Forms.PictureBox pictureBox7; public ComSFXFront _sfx; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; public Form1(ComSFXFront sfx) { // // Required for Windows Form Designer support // InitializeComponent(); this._sfx=sfx; // // TODO: Add any constructor code after InitializeComponent call // } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #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> private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox3 = new System.Windows.Forms.PictureBox(); this.pictureBox4 = new System.Windows.Forms.PictureBox(); this.button1 = new System.Windows.Forms.Button(); this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox3 = new System.Windows.Forms.TextBox(); this.pictureBox5 = new System.Windows.Forms.PictureBox(); this.pictureBox6 = new System.Windows.Forms.PictureBox(); this.pictureBox7 = new System.Windows.Forms.PictureBox(); this.SuspendLayout(); // // pictureBox1 // this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.pictureBox1.Location = new System.Drawing.Point(120, 280); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(176, 72); this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; // // pictureBox2 // this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); this.pictureBox2.Location = new System.Drawing.Point(120, 352); this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Size = new System.Drawing.Size(176, 72); this.pictureBox2.TabIndex = 1; this.pictureBox2.TabStop = false; // // pictureBox3 // this.pictureBox3.BackColor = System.Drawing.SystemColors.Control; this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image"))); this.pictureBox3.Location = new System.Drawing.Point(112, 32); this.pictureBox3.Name = "pictureBox3"; this.pictureBox3.Size = new System.Drawing.Size(176, 72); this.pictureBox3.TabIndex = 2; this.pictureBox3.TabStop = false; // // pictureBox4 // this.pictureBox4.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox4.Image"))); this.pictureBox4.Location = new System.Drawing.Point(112, 104); this.pictureBox4.Name = "pictureBox4"; this.pictureBox4.Size = new System.Drawing.Size(176, 72); this.pictureBox4.TabIndex = 3; this.pictureBox4.TabStop = false; // // button1 // this.button1.Location = new System.Drawing.Point(376, 8); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(56, 24); this.button1.TabIndex = 4; this.button1.Text = "sfx"; this.button1.Click += new System.EventHandler(this.button1_Click); // // textBox1 // this.textBox1.Location = new System.Drawing.Point(88, 464); this.textBox1.Name = "textBox1"; this.textBox1.ReadOnly = true; this.textBox1.Size = new System.Drawing.Size(224, 20); this.textBox1.TabIndex = 5; this.textBox1.Text = ""; // // textBox2 // this.textBox2.Location = new System.Drawing.Point(88, 488); this.textBox2.Name = "textBox2"; this.textBox2.ReadOnly = true; this.textBox2.Size = new System.Drawing.Size(224, 20); this.textBox2.TabIndex = 6; this.textBox2.Text = ""; // // textBox3 // this.textBox3.Location = new System.Drawing.Point(88, 512); this.textBox3.Name = "textBox3"; this.textBox3.ReadOnly = true; this.textBox3.Size = new System.Drawing.Size(224, 20); this.textBox3.TabIndex = 7; this.textBox3.Text = ""; // // pictureBox5 // this.pictureBox5.Location = new System.Drawing.Point(320, 472); this.pictureBox5.Name = "pictureBox5"; this.pictureBox5.Size = new System.Drawing.Size(24, 16); this.pictureBox5.TabIndex = 8; this.pictureBox5.TabStop = false; // // pictureBox6 // this.pictureBox6.Location = new System.Drawing.Point(320, 496); this.pictureBox6.Name = "pictureBox6"; this.pictureBox6.Size = new System.Drawing.Size(24, 16); this.pictureBox6.TabIndex = 9; this.pictureBox6.TabStop = false; // // pictureBox7 // this.pictureBox7.Location = new System.Drawing.Point(320, 520); this.pictureBox7.Name = "pictureBox7"; this.pictureBox7.Size = new System.Drawing.Size(24, 16); this.pictureBox7.TabIndex = 10; this.pictureBox7.TabStop = false; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(440, 613); this.Controls.Add(this.pictureBox7); this.Controls.Add(this.pictureBox6); this.Controls.Add(this.pictureBox5); this.Controls.Add(this.textBox3); this.Controls.Add(this.textBox2); this.Controls.Add(this.textBox1); this.Controls.Add(this.button1); this.Controls.Add(this.pictureBox4); this.Controls.Add(this.pictureBox3); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.pictureBox1); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); } #endregion private void button1_Click(object sender, System.EventArgs e) { Telecommande tc = new Telecommande(this._sfx); tc.Show(); } } } Mais pour lancer tout ca j'utilise un truc genre Class1.cs : using System; using System.Windows.Forms; using System.Threading; namespace CenzubIHM { /// <summary> /// Summary description for Main. /// </summary> public class Class1 { [STAThread] static void Main(string[] args) { ComSFXFront sfx = new ComSFXFront(); this.sfx.Connect(); Thread.Sleep(300); Form1 form1 = new Form1(sfx); ComIHM cihm = new ComIHM(ref form1); Thread client = new Thread(new ThreadStart(cihm.Start)); client.Start(); Application.Run(form1); } } }
24 août 2014 à 12:39