begin process at 2008 08 30 02:53:41
1 233 993 membres
30 nouveaux aujourd'hui
14 294 membres club

Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum.
Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

Sujet : Actulisation/ouverture d'une fenêtre sur PDA en C# [ Divers / Général ] (Diafwl1)

Actulisation/ouverture d'une fenêtre sur PDA en C# le 16/05/2007 13:12:32

Diafwl1
Bonjour, Je suis en trein de faire des tests sur PDA et j'ai un petit problème, je n'arrive pas à afficher une fenêtre par dessous une autre (ou actuliser cette fenêtre) sur le PDA. j'aimerai tout simplement afficher une fenêtre contenant des bouttons, et losque l'on clic sur l'un deux, une nouvelle fenêtre avec d'autres bouttons apparait. Malheureusement je n'arrive pas à obtenir la 2nd fenêtre. Mon code ressemble à sa : using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.Label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// Label1
//
this.Label1.Location = new System.Drawing.Point(3, 0);
this.Label1.Name = "Label1";
this.Label1.Size = new System.Drawing.Size(100, 20);
this.Label1.Text = "Choisir services :";
this.Label1.ParentChanged += new System.EventHandler(this.label1_ParentChanged);
//
// button1
//
this.button1.Location = new System.Drawing.Point(0, 23);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(240, 42);
this.button1.TabIndex = 1;
this.button1.Text = "Service 1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(0, 71);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(240, 42);
this.button2.TabIndex = 3;
this.button2.Text = "Service 2";
this.button2.Click += new System.EventHandler(this.button2_Click);
[...]//equivalent pour les autres bouttons
//
// Form1
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.ClientSize = new System.Drawing.Size(240, 294);
this.Controls.Add(this.button6);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.Label1);
this.Name = "Form1";
this.ResumeLayout(false);
}
private void Service1()
{
this.Label11 = new System.Windows.Forms.Label();
this.button11 = new System.Windows.Forms.Button();
this.button12 = new System.Windows.Forms.Button();
this.button13 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// Label1
//
this.Label11.Location = new System.Drawing.Point(3, 0);
this.Label11.Name = "Label11";
this.Label11.Size = new System.Drawing.Size(100, 20);
this.Label11.Text = "Choisir services :";
//
// button1
//
this.button11.Location = new System.Drawing.Point(0, 23);
this.button11.Name = "button11";
this.button11.Size = new System.Drawing.Size(240, 42);
this.button11.TabIndex = 1;
this.button11.Text = "Service 1.1";
this.button11.Click += new System.EventHandler(this.button1_Click);
[...]//equivalent pour les autre bouttons
//
// Service1
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.ClientSize = new System.Drawing.Size(240, 294);
this.Controls.Add(this.button13);
this.Controls.Add(this.button12);
this.Controls.Add(this.button11);
this.Controls.Add(this.Label11);
this.Name = "Service1";
this.ResumeLayout(false);
}
private void button1_Click(object sender, EventArgs e)
{
Service1();
}
}

Re : Actulisation/ouverture d'une fenêtre sur PDA en C# le 16/05/2007 14:39:20

Baguauda
essaye dans service1()

this.show();

Re : Actulisation/ouverture d'une fenêtre sur PDA en C# le 16/05/2007 16:05:08

Diafwl1
je l'ai placé après "this.ResumeLayout(false);" mais rien n'a changé. Je me demande si service1 ne devrait pas se trouver à l'extérieur de Form1 ?

Re : Actulisation/ouverture d'une fenêtre sur PDA en C# le 17/05/2007 14:10:15

Baguauda
Service 1 peut être placer dans form1 mais n'utilise pas this car du coup tucible form1.
Si tu veux construire ainsi ton autre form fait plutot un truc dans le style
System.Windows.Forms servive1Form = new System.Windows.Forms();
et ensuite remplace les this par servive1Form

Re : Actulisation/ouverture d'une fenêtre sur PDA en C# le 20/05/2007 22:17:49

Stephane33
Membre Club
(Admin CS)
Réponse acceptée !

Si il s'agit d'une autre form Service1 devra être déclarée comme une classe
     public partial class Service1 : Form
     {
         public Service1()
         {
             InitializeComponent();
         }
          private void InitializeComponent()
         {
             this.Label11 = new System.Windows.Forms.Label();
             this.button11 = new System.Windows.Forms.Button();
             this.button12 = new System.Windows.Forms.Button();
             this.button13 = new System.Windows.Forms.Button();
            this.SuspendLayout();
             // 
             // Label1
             // 
             this.Label11.Location = new System.Drawing.Point(3, 0);
             this.Label11.Name = "Label11";
             this.Label11.Size = new System.Drawing.Size(100, 20);
             this.Label11.Text = "Choisir services :";
             // 
             // button1
             // 
             this.button11.Location = new System.Drawing.Point(0, 23);
             this.button11.Name = "button11";
             this.button11.Size = new System.Drawing.Size(240, 42);
             this.button11.TabIndex = 1;
             this.button11.Text = "Service 1.1";
             this.button11.Click += new System.EventHandler(this.button1_Click);
  [...]//equivalent pour les autre bouttons
              // 
             // Service1
             // 
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
             this.ClientSize = new System.Drawing.Size(240, 294);
             this.Controls.Add(this.button13);
             this.Controls.Add(this.button12);
             this.Controls.Add(this.button11);
             this.Controls.Add(this.Label11);
             this.Name = "Service1";
             this.ResumeLayout(false);
         }
}

Et sous ta form1 tu feras sur button1.click
(en VB.net cela donne)

Dim MyService as Service1
MyService =new Service1
MyService.show


Sinon pouruoi ne pas utiliser un panel

Le savoir ne sert que si il est partagé par tous

Re : Actulisation/ouverture d'une fenêtre sur PDA en C# le 20/05/2007 22:18:48

Stephane33
Membre Club
(Admin CS)
Je suis plus sur VB.net, mais le plus simple c'est d'ajouter une Form à ton projet.


Le savoir ne sert que si il est partagé par tous

Re : Actulisation/ouverture d'une fenêtre sur PDA en C# le 23/05/2007 19:21:33

Diafwl1
J'avoue que je n'ais pas pensé au panel ! Tu voudrais donc que je crée un panel et dessine les bouttons dessus ? Merci pour ta solution, elle fonctionne ! Pour lancer le service1, dans le button1_Click, j'ai mis : Service1 serv1 = new Service1(); serv1.Show(); Par contre je voulais savoir si cette solution ouvrait une nouvelle fenêtre par dessus l'autre ou actualise celle-ci ?

Re : Actulisation/ouverture d'une fenêtre sur PDA en C# le 23/05/2007 19:27:03

Diafwl1
J'ai la réponse, sa ouvre une nouvelle fenêtre !
Que faut-il faire pour que sa actualise la page ?

Re : Actulisation/ouverture d'une fenêtre sur PDA en C# le 23/05/2007 20:11:41

Stephane33
Membre Club
(Admin CS)
Réponse acceptée !

Si c'est sur ta nouvelle page, c'est une classe dont avec tous ses contrôles théoriquement accessibles ex Service1.MonLabel.Caption ="Test"
Le Panel est plus simple à géré, puisqu'il dépend de ta form et donc consomme moins de ressources. Il suffit de le masquer ou de l'afficher au besoin..
Le savoir ne sert que si il est partagé par tous

Re : Actulisation/ouverture d'une fenêtre sur PDA en C# le 23/05/2007 21:37:09

Diafwl1
Voila j'ai mis toute ma form1 dans un Panel sauf un boutton pour éviter de le réafficher à chaque changement de page.
Je suppose que je dois-je faire la même chose du coté de service1, il y aura donc 1 Panel pour chaque fenêtre ?
Il vaut peut etre mieux que je mette un nouveau panel dans la form1 ?
Pour rendre invisible le panel, il faut surment ecrire quelque chose qui ressemble à :
panel1.Visible = False;


[Page 1 Page 2]
Classé sous : windows, system, forms, button1, drawing

Participer à cet échange

Pub



Appels d'offres

Recherche developpeur ...
Budget : 700€
SITE MARCHAND LOCATION...
Budget : 3 000€
SITE MARCHAND POUR HOTEL
Budget : 4 000€

CalendriCode

Août 2008
LMMJVSD
    123
45678910
11121314151617
18192021222324
25262728293031

Boutique

Boutique de goodies CodeS-SourceS