public CChampTimosWebApp(DataSet ds, I2iWebControl wndControl, IElementAVariables elementEdite, int nIdGroupe, string strIdCarac, bool bIsEditable) { DataTable dt = ds.Tables[c_nomTable]; if (dt == null) { return; } m_elementAVariables = elementEdite; DataRow row = dt.NewRow(); string strNomChamp = wndControl.WebLabel; string strLibelleWeb = wndControl.WebLabel; int nIdChampFictif; if (!s_dicWebControl.TryGetValue(strLibelleWeb, out nIdChampFictif)) { nIdChampFictif = s_nIdChampFictif++; s_dicWebControl.Add(strLibelleWeb, nIdChampFictif); } int nIdChampCustom = -1; int nOrdreWeb = wndControl.WebNumOrder; int nTypeDonneeChamp = 2; // par défaut type string bool bIsChoixParmis = false; bool bIsMultiline = false; string strCustomClass = ""; if (wndControl is C2iWndChampCustom) { C2iWndChampCustom wndChamp = (C2iWndChampCustom)wndControl; bIsMultiline = wndChamp.MultiLine; CChampCustom champ = wndChamp.ChampCustom; if (champ != null) { m_champ = champ; nIdChampCustom = champ.Id; strNomChamp = champ.Nom; nTypeDonneeChamp = (int)champ.TypeDonneeChamp.TypeDonnee; bIsChoixParmis = champ.IsChoixParmis(); } } else if (wndControl is C2iWndFormule) { C2iWndFormule wndFormule = (C2iWndFormule)wndControl; C2iExpression formule = wndFormule.Formule; if (formule != null) { m_formule = formule; bIsEditable = false; } } else if (wndControl is C2iWndPanel || wndControl is C2iWndSlidingPanel) { bIsEditable = false; strCustomClass = "sous-titre-champ"; } row[c_champId] = bIsEditable ? nIdChampCustom : nIdChampFictif; row[c_champIdTimos] = nIdChampCustom; row[c_champNom] = strNomChamp; row[c_champLibelleConvivial] = strLibelleWeb == "" ? strNomChamp : strLibelleWeb; row[c_champOrdreAffichage] = nOrdreWeb; row[c_champTypeDonne] = nTypeDonneeChamp; row[c_champIsChoixParmis] = bIsChoixParmis && bIsEditable; row[c_champIsMultiline] = bIsMultiline; row[c_champIsEditable] = bIsEditable; row[c_champCustomClass] = strCustomClass; row[c_champIdGroupeChamps] = nIdGroupe; row[c_champIdCaracteristique] = strIdCarac; row[c_champUseAutoComplete] = false; m_row = row; dt.Rows.Add(row); }
protected override void MyCreateControle( CCreateur2iFormulaireV2 createur, C2iWnd wnd, Control parent, IFournisseurProprietesDynamiques fournisseurProprietes) { C2iWndFormule wndExpression = wnd as C2iWndFormule; if (wndExpression == null) { return; } CCreateur2iFormulaireV2.AffecteProprietesCommunes(wndExpression, m_label); BorderStyle bstyle = BorderStyle.Fixed3D; switch (wndExpression.BorderStyle) { case C2iWndLabel.LabelBorderStyle._3D: bstyle = BorderStyle.Fixed3D; break; case C2iWndLabel.LabelBorderStyle.Aucun: bstyle = BorderStyle.None; break; case C2iWndLabel.LabelBorderStyle.Plein: bstyle = BorderStyle.FixedSingle; break; } //Dans une grille, on met une texte box pour pouvoir utiliser les touches if (wndExpression.Parent != null && wndExpression.Parent is C2iWndDataGridColumn) { m_control = m_textBox; m_textBox.LockEdition = true; m_textBox.Text = ""; m_textBox.Multiline = true; m_textBox.BorderStyle = bstyle; switch (wndExpression.TextAlign) { case System.Drawing.ContentAlignment.TopLeft: case System.Drawing.ContentAlignment.MiddleLeft: case System.Drawing.ContentAlignment.BottomLeft: m_textBox.TextAlign = HorizontalAlignment.Left; break; case System.Drawing.ContentAlignment.BottomCenter: case System.Drawing.ContentAlignment.MiddleCenter: case System.Drawing.ContentAlignment.TopCenter: m_textBox.TextAlign = HorizontalAlignment.Center; break; case System.Drawing.ContentAlignment.BottomRight: case System.Drawing.ContentAlignment.MiddleRight: case System.Drawing.ContentAlignment.TopRight: m_textBox.TextAlign = HorizontalAlignment.Right; break; } } else { m_control = m_label; m_label.Text = ""; m_label.TextAlign = wndExpression.TextAlign; m_label.BorderStyle = bstyle; } parent.Controls.Add(m_control); }