/// <summary> /// Affichage du filtre dans l'interface /// Remplissage de ListeComboBox /// </summary> private void InitInterface() { this.DisplayMember = ""; this.ValueMember = "Id"; int index = 10; // Si un objet du critère de selection exite dans la classe // Nous cherchons sa valeur pour l'utiliser foreach (Type item in this.ConfigProperty.SelectionCriteria.CriteriasTypes) { // Meta information d'affichage du de Critère GwinEntityAttribute DisplayEntityAttributeCritere = (GwinEntityAttribute)item.GetCustomAttribute(typeof(GwinEntityAttribute)); // Size Filter Item Size SizeControlFilter = new Size(this.SizeControl.Width, 25); ManyToOneField manyToOneFilter = new ManyToOneField(this.Service, item, null, null, this.OrientationFiled, this.SizeLabel, SizeControlFilter, 0, this.ConfigProperty.ConfigEntity, this.ValueEntity ); manyToOneFilter.Name = item.Name; //manyToOneFilter.Size = new System.Drawing.Size(this.widthField, this.HeightField); manyToOneFilter.TabIndex = ++index; manyToOneFilter.Text_Label = item.Name; manyToOneFilter.ValueMember = "Id"; manyToOneFilter.DisplayMember = DisplayEntityAttributeCritere.DisplayMember; // pour le chargement de comboBox Suivant manyToOneFilter.ValueChanged += Value_SelectedIndexChanged; manyToOneFilter.Visible = true; // [bug] Le contôle ne s'affiche pas dans le formilaire ?? //Form f = new Form(); //f.Controls.Add(manyToOneFilter); //f.Show(); this.MainContainner.Controls.Add(manyToOneFilter); ListeComboBox.Add(item.Name, manyToOneFilter); LsiteTypeObjetCritere.Add(item.Name, item); } }
/// <summary> /// Affichage du filtre dans l'interface /// Remplissage de ListeComboBox /// </summary> private void CreateInterface() { // // Suppresion de la zone de filtre si les critères de filtrage n'existe pas // if (this.MetaSelectionCriteria == null) { groupBoxFilter.Visible = false; groupBoxListChoices.Location = new Point(12, 0); groupBoxDisplaySelected.Location = new Point(12, groupBoxListChoices.Location.Y + groupBoxListChoices.Size.Height + 10); return; } // // Création de l'interface // // Positions int index = 0; int y = 20; // Si un objet du critère de selection exite dans la classe // Nous cherchons sa valeur pour l'utiliser foreach (Type item in MetaSelectionCriteria.CriteriasTypes) { // Meta information d'affichage du de Critère GwinEntityAttribute MetaAffichageClasseCritere = (GwinEntityAttribute)item.GetCustomAttribute(typeof(GwinEntityAttribute)); // // label1 // Label label_comboBox = new Label(); label_comboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); label_comboBox.AutoSize = true; label_comboBox.Location = new System.Drawing.Point(6, y); label_comboBox.Name = "label_" + item.Name; label_comboBox.Size = new System.Drawing.Size(35, 13); label_comboBox.TabIndex = ++index; label_comboBox.Text = item.Name; // // ComBobox // ComboBox comboBox = new ComboBox(); comboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); comboBox.FormattingEnabled = true; comboBox.Location = new System.Drawing.Point(6, y + 20); comboBox.Name = "comboBoxFilter_" + item.Name;; comboBox.Size = new System.Drawing.Size(250, 21); comboBox.ValueMember = "Id"; comboBox.DisplayMember = MetaAffichageClasseCritere.DisplayMember; comboBox.TabIndex = ++index;; comboBox.SelectedIndexChanged += Value_SelectedIndexChanged; this.groupBoxFilter.Controls.Add(label_comboBox); this.groupBoxFilter.Controls.Add(comboBox); ListeComboBox.Add(item.Name, comboBox); LsiteTypeObjetCritere.Add(item.Name, item); y += 40; } // // Redimention de l'interface // groupBoxFilter.Location = new Point(12, 5); groupBoxFilter.Size = new System.Drawing.Size(188, y); groupBoxListChoices.Location = new Point(12, groupBoxFilter.Location.Y + groupBoxFilter.Size.Height + 10); groupBoxDisplaySelected.Location = new Point(12, groupBoxListChoices.Location.Y + groupBoxListChoices.Size.Height + 10); }