private void SetMessageForLabel(clsLabel _label, string strMsgID) { clsLanguage objMessage; if (strMsgID.StartsWith("$")) { _label.Text = strMsgID.Substring(1, strMsgID.Length - 1).ToString(); return; } if (strMsgID.Trim() == "") { if (_label.Text.Trim() != "") { _label.Text = "** " + _label.Text; } return; } objMessage = new clsLanguage(); string strTemp = objMessage.LanguageString(strMsgID); if (strTemp == "*****") { _label.ForeColor = System.Drawing.Color.Orange; _label.Text = "**" + _label.Text; } else { _label.Text = strTemp; } objMessage.Dispose(); objMessage = null; }
private clsLabel LabelGenerator(string MessageId, string Text,int Width, bool IsBlank,int colWidth, PaintType type,BorderType _BorderType) { try { clsLabel _Label = new clsLabel(); _Label.TypeOfPaint = type; _Label.TypeOfBorder = _BorderType; _Label.BackColor = System.Drawing.Color.Transparent; _Label.Dock = System.Windows.Forms.DockStyle.Left; _Label.FieldType = ICTEAS.WinForms.Controls.LabelType.Optional; //if (!IsBlank) // _Label.BorderStyle = BorderStyle.FixedSingle; //else // _Label.BorderStyle = BorderStyle.FixedSingle; _Label.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; _Label.Location = new System.Drawing.Point(0, 0); _Label.MessageID = MessageId; _Label.Name = "lbl" + Text; _Label.NormalFont = true; _Label.ResourceName = ""; _Label.Size = new Size(colWidth, this.Height); //if (!IsBlank) // _Label.Size = new System.Drawing.Size(Width, this.Height); //else // _Label.Size = new Size(colWidth, this.Height); _Label.TabIndex = 6; _Label.Text = Text; if (!IsBlank) SetMessageForLabel(_Label, MessageId); else _Label.Text = ""; _Label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; return _Label; } catch { return null; } }