public string GetDisplayField(ExtControlBase controlBase, int ColumnsPerRow) { NGLabel ngLabel = new NGLabel(); ngLabel = controlBase as NGLabel; sb = string.Format(@" xtype: '{0}', value: Lang.{2}||'{1}', name: '{3}', id: '{3}', itemId: '{3}', colspan: {4}, hidden: {5}, x:{6}, y:{7}, width:{8}, fieldStyle:'{9}', labelSeparator: '' ", controlBase.XType, ngLabel.Text, FormTableName + "_" + controlBase.Name, controlBase.Name, ngLabel.IsTitle.Equals(true) && ColumnsPerRow != 0 ? ColumnsPerRow.ToString() : controlBase.ColSpan.ToString(), controlBase.Visible.Equals(true) ? "false" : "true", controlBase.XPos, controlBase.YPos, controlBase.LabelWidth, controlBase.FieldStyle); if (ngLabel.IsTitle) { sb += ",anchor: '100%'"; } return(sb); }
public static DialogResult InputBox(string title, string promptText, ref string value) { var form = new Form(); var label = new NGLabel(); var textBox = new NGTextBox(); var buttonOk = new NGButton(); var buttonCancel = new NGButton(); label.Text = promptText; label.AutoSize = true; label.SetBounds(9, 20, 372, 13); textBox.Text = value; textBox.BorderStyle = BorderStyle.Fixed3D; textBox.Anchor = textBox.Anchor | AnchorStyles.Right; textBox.SetBounds(12, 36, 372, 20); buttonOk.Text = Language.strButtonOK; buttonOk.DialogResult = DialogResult.OK; buttonOk.FlatStyle = FlatStyle.Flat; buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonOk.SetBounds(228, 72, 75, 23); buttonCancel.Text = Language.strButtonCancel; buttonCancel.DialogResult = DialogResult.Cancel; buttonCancel.FlatStyle = FlatStyle.Flat; buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonCancel.SetBounds(309, 72, 75, 23); form.Text = title; form.ClientSize = new Size(396, 107); form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel }); form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height); form.FormBorderStyle = FormBorderStyle.FixedDialog; form.StartPosition = FormStartPosition.CenterScreen; form.MinimizeBox = false; form.MaximizeBox = false; form.AcceptButton = buttonOk; form.CancelButton = buttonCancel; form.BackColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Background"); form.ForeColor = Themes.ThemeManager.getInstance().ActiveTheme.ExtendedPalette.getColor("Dialog_Foreground"); var dialogResult = form.ShowDialog(); value = textBox.Text; return(dialogResult); }
public static NGLabel GetLabel(PbBaseControlInfo pbCtl) { PbLabelInfo pbLabel = (PbLabelInfo)pbCtl; NGLabel ngLabel = new NGLabel(); string alignment = string.Empty; ngLabel.ID = pbLabel.Name; ngLabel.Name = pbLabel.Name; ngLabel.Text = pbLabel.LeftText; ngLabel.FieldLabel = pbLabel.LeftText; ngLabel.XType = "displayfield"; ngLabel.Visible = pbLabel.Visible; ngLabel.Font = pbLabel.Font; ngLabel.Align = pbLabel.Align; if (pbCtl.IsTitle) { ngLabel.IsTitle = true; } switch (ngLabel.Align) { case 0: alignment = "left"; break; case 1: alignment = "right"; break; case 2: alignment = "center"; break; } ngLabel.FieldStyle = string.Format("text-align: {0};font-size: {1}pt !important;color:{2};", alignment, ngLabel.Font, GetRgb(pbLabel.LabelTextColor)); return(ngLabel); }