public void SetResult(string result, SimpleLabelItem label) { if (result == "Y") { label.Text = String.Format(" 修改成功"); label.AppearanceItemCaption.BackColor = Color.PaleGreen; LogDal.Insert(Nodes.Entities.ELogType.应急处理_退货单, String.Format("{0}:{1}", GlobeSettings.LoginedUser.UserName, GlobeSettings.LoginedUser.UserCode), txtReturnBillID.Text, "应急处理"); } else { label.Text = String.Format(" {0}", result); label.AppearanceItemCaption.BackColor = Color.Red; } }
public static void ExpandCore(ICollection baseItemCollection, SimpleLabelItem button, bool conversely) { foreach (BaseLayoutItem bli in baseItemCollection) { bli.Visibility = LayoutVisibility.Always; } if (conversely) { button.Image = Image.FromStream(Assembly.GetEntryAssembly().GetManifestResourceStream("DevExpress.DevAV.Resources.ArrowRight.png")); } else { button.Image = Image.FromStream(Assembly.GetEntryAssembly().GetManifestResourceStream("DevExpress.DevAV.Resources.ArrowLeft.png")); } }
private void CreateTopLabel(TopBl item) { layoutControl1.BeginUpdate(); try { // Create a layout item that will display a new base SimpleLabelItem simpleLabel = new SimpleLabelItem(); simpleLabel.Parent = layoutControlGroup1; simpleLabel.Name = "simpleLabelTop" + item.Id; simpleLabel.Text = $"{item.Name} ({item.Comment})"; simpleLabel.Tag = item; //simpleLabel.OptionsToolTip.ToolTip = $"{item.Name} ({item.Comment})"; //simpleLabel.OptionsToolTip.ImmediateToolTip = true; simpleLabel.DoubleClick += new System.EventHandler(this.lable_DoubleClick); simpleLabel.Move(layoutControlItemButtonTop, InsertType.Top); } finally { // Unlock and update the layout control. layoutControl1.EndUpdate(); } }
public static void Expand(ICollection baseItemCollection, SimpleLabelItem button) { ExpandCore(baseItemCollection, button, false); }
public static void Hide(ICollection baseItemCollection, SimpleLabelItem button) { HideCore(baseItemCollection, button, false); }
public void BindControls() { if (Questionnaire == null) MessageBox.Show("Questionnaire must be bind with JSON first.", "MultipleChoice Component"); isLoaded = false; this.layoutControlGroupQuestion1.Clear(); Settings oSettings = Questionnaire.Form.Settings; m_DynamicControls = new List<DynamicControl>(); // layoutControlGroupQuestion1 this.layoutControlGroupQuestion1.Name = "layoutControlGroupQuestion" + Guid.NewGuid().ToString(); this.layoutControlGroupQuestion1.AppearanceGroup.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); this.layoutControlGroupQuestion1.AppearanceGroup.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical; this.layoutControlGroupQuestion1.AppearanceGroup.Options.UseFont = true; this.layoutControlGroupQuestion1.ExpandButtonVisible = false; this.layoutControlGroupQuestion1.GroupBordersVisible = true; this.layoutControlGroupQuestion1.TextVisible = false; this.layoutControlGroupQuestion1.Padding = new DevExpress.XtraLayout.Utils.Padding(1, 1,1, 1); this.layoutControlGroupQuestion1.ShowInCustomizationForm = false; //this.layoutControlGroupQuestion1.Size = new System.Drawing.Size(417, 64); //this.layoutControlGroupQuestion1.Text = oSettings.Label + " " + oSettings.QuestionText; this.layoutControlGroupQuestion1.BeginUpdate(); #region Footer this.layoutControlItem1 = new LayoutControlItem(); this.layoutControlItem1.Name = "layoutControlItem" + Guid.NewGuid().ToString(); //bool isCustomerOwnershipOnly = false; //if (oSettings.CustomerOwnership && oSettings.BVOwnership) // isCustomerOwnershipOnly = true; //ctlFooter = new Footer() { // IsAccountLevel = oSettings.DataBindings.account_level, // IsCustomerOwnershipOnly = isCustomerOwnershipOnly, // HelpText = oSettings.QuestionHelp, // LanguageCode = oSettings.DataBindings.language_code //}; ctlFooter = new Footer() { IsAccountLevel = oSettings.DataBindings.account_level, IsCustomerOwned = oSettings.CustomerOwnership, IsBrightvisionOwned = oSettings.BVOwnership, HelpText = oSettings.QuestionHelp, LanguageCode = oSettings.DataBindings.language_code, QuestionText = oSettings.Label + " " + oSettings.QuestionText }; ctlFooter.InitializeFooter(); ctlFooter.Dock = DockStyle.Fill; ctlFooter.Height = 20; this.layoutControlItem1.Control = ctlFooter; this.layoutControlItem1.ShowInCustomizationForm = false; this.layoutControlItem1.TextVisible = false; this.layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); this.layoutControlItem1.MinSize = new Size(0, 24); this.layoutControlItem1.MaxSize = new Size(0, 24); this.layoutControlItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlItem1.SizeConstraintsType = SizeConstraintsType.Custom; this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem1); #endregion IList<AnswerOption> answeroptionList = Questionnaire.Form.Settings.AnswerOptions; IMultipleChoice answeroption = null; List<MultipleChoiceValue> mcvalueList = null; int iAnswerOptions = answeroptionList.Count; int numCols = 1; int numRows = 1; LayoutControlItem refColItem = null, prevItem = null, lastItem = null; List<LayoutControlItem> listItems = null; int idx = 0; int refColItemWidth = 0; for (int x = 0; x < iAnswerOptions; ++x) { answeroption = answeroptionList[x] as IMultipleChoice; simpleLabelItemValidation = new SimpleLabelItem(); simpleLabelItemValidation.AppearanceItemCaption.BackColor = Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128))))); simpleLabelItemValidation.Name = Guid.NewGuid().ToString(); simpleLabelItemValidation.TextAlignMode = TextAlignModeItem.CustomSize; simpleLabelItemValidation.TextSize = new Size(212, 15); simpleLabelItemValidation.Text = " Please check at least one item below."; simpleLabelItemValidation.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; this.layoutControlGroupQuestion1.AddItem(simpleLabelItemValidation); mcvalueList = answeroption.MultipleChoiceValues; numCols = answeroption.MultipleChoiceColumns; numRows = Convert.ToInt16(Math.Ceiling(Convert.ToDouble(mcvalueList.Count) / Convert.ToDouble(numCols))); listItems = new List<LayoutControlItem>(); for (int i = 1; i <= numCols; ++i) { for (int q = 1; q <= numRows && idx < mcvalueList.Count ; ++q) { if (i > 1 && q == 1) { lastItem = refColItem; } if (q == 1) { refColItem = new LayoutControlItem(); refColItem.Padding = new DevExpress.XtraLayout.Utils.Padding(0); refColItem.Spacing = new DevExpress.XtraLayout.Utils.Padding(0); //add checkedit this.checkEdit1 = new CheckEdit(); this.checkEdit1.Tag = new MultiplechoiceData() { ParentPositionIndex = "IndexPosition" + x.ToString(), PositionIndex = "IndexPosition" + idx, ControlContainer = refColItem }; this.checkEdit1.Text = mcvalueList[idx].TextPrefix; this.checkEdit1.Checked = mcvalueList[idx].Checked; this.checkEdit1.Name = "checkEdit" + Guid.NewGuid().ToString(); //this.checkEdit1.StyleController = this.StyleController; this.checkEdit1.AutoSizeInLayoutControl = true; checkEdit1.CheckedChanged += new EventHandler(checkEdit1_CheckedChanged); m_DynamicControls.Add(new DynamicControl() { Control = this.checkEdit1, Name = this.checkEdit1.Name, DefaultValue = this.checkEdit1.Checked, TextPrefix = this.checkEdit1.Text }); refColItem.Name = "layoutControlItem" + Guid.NewGuid().ToString(); refColItem.Control = this.checkEdit1; refColItem.TextVisible = false; refColItem.MinSize = new Size(0, 17); refColItem.MaxSize = new Size(0, 17); refColItem.SizeConstraintsType = SizeConstraintsType.Custom; refColItem.Click += new EventHandler(layoutControlGroupQuestion1_Click); refColItem.AllowAutoAlignment = true; if (refColItemWidth < this.checkEdit1.Width) refColItemWidth = this.checkEdit1.Width; if (i > 1) { layoutControlGroupQuestion1.AddItem(refColItem, lastItem, DevExpress.XtraLayout.Utils.InsertType.Right); } else { layoutControlGroupQuestion1.AddItem(refColItem); } listItems.Add(refColItem); } else { this.layoutControlItem1 = new LayoutControlItem(); this.layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(0); this.layoutControlItem1.Spacing = new DevExpress.XtraLayout.Utils.Padding(0); //add checkedit this.checkEdit1 = new CheckEdit(); this.checkEdit1.Tag = new MultiplechoiceData() { ParentPositionIndex = "IndexPosition" + x.ToString(), PositionIndex = "IndexPosition" + idx, ControlContainer = layoutControlItem1 }; this.checkEdit1.Text = mcvalueList[idx].TextPrefix; this.checkEdit1.Checked = mcvalueList[idx].Checked; this.checkEdit1.Name = "checkEdit" + Guid.NewGuid().ToString(); this.checkEdit1.StyleController = this.StyleController; checkEdit1.CheckedChanged += new EventHandler(checkEdit1_CheckedChanged); m_DynamicControls.Add(new DynamicControl() { Control = this.checkEdit1, Name = this.checkEdit1.Name, DefaultValue = this.checkEdit1.Checked, TextPrefix = this.checkEdit1.Text }); this.layoutControlItem1.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.layoutControlItem1.Control = this.checkEdit1; this.layoutControlItem1.TextVisible = false; this.layoutControlItem1.MinSize = new Size(0, 17); this.layoutControlItem1.MaxSize = new Size(0, 17); this.layoutControlItem1.SizeConstraintsType = SizeConstraintsType.Custom; this.layoutControlItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); if (q > 1 && i==1) { this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem1); } else { if ((idx-numRows) >= 0) { this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem1, listItems[idx - numRows], DevExpress.XtraLayout.Utils.InsertType.Right); } } listItems.Add(this.layoutControlItem1); prevItem = this.layoutControlItem1; } idx++; } } idx = 0; //EmptySpaceItem esitem = new EmptySpaceItem(); //esitem.Size = new Size(100,20); //this.layoutControlGroupQuestion1.AddItem(esitem); foreach (OtherChoice oChoice in answeroption.OtherChoices) { if (oChoice.Enabled) { //if (!string.IsNullOrEmpty(oChoice.TextPrefix)) { // // simpleLabelItem1 // this.simpleLabelItem1 = new DevExpress.XtraLayout.SimpleLabelItem(); // this.simpleLabelItem1.Name = "simpleLabelItem" + Guid.NewGuid().ToString(); // //this.simpleLabelItem1.ShowInCustomizationForm = false; // //this.simpleLabelItem1.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; // this.simpleLabelItem1.Text = oChoice.TextPrefix; // //newSize = new System.Drawing.Size(100, 20); // newSize = new System.Drawing.Size(20, 20); // this.simpleLabelItem1.SizeConstraintsType = SizeConstraintsType.Custom; // this.simpleLabelItem1.MaxSize = newSize; // this.simpleLabelItem1.MinSize = newSize; // this.simpleLabelItem1.Size = newSize; // this.simpleLabelItem1.AppearanceItemCaption.BackColor = System.Drawing.Color.Transparent; // this.simpleLabelItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); // this.layoutControlGroupQuestion1.AddItem(this.simpleLabelItem1); //} else { // this.simpleLabelItem1 = null; //} // layoutControlItem1 this.layoutControlItem1 = new LayoutControlItem(); //add textEdit1 to layout this.memoEdit1 = new MemoEdit(); this.memoEdit1.Tag = new MultiplechoiceData() { ParentPositionIndex = "IndexPosition" + x.ToString(), PositionIndex = "IndexPosition" + idx.ToString(), ControlContainer = layoutControlItem1, Required = oChoice.Required, HasValue = !string.IsNullOrWhiteSpace(oChoice.DefaultInputValue) ? true : false, ChoiceOption = oChoice }; this.memoEdit1.Name = "textEdit" + Guid.NewGuid().ToString(); this.memoEdit1.Properties.ScrollBars = ScrollBars.None; this.memoEdit1.StyleController = this.StyleController; //set value string _DefaultValue = string.Empty; if (oChoice.DefaultInputValue != null) { _DefaultValue = oChoice.DefaultInputValue.Trim(); this.memoEdit1.Text = oChoice.DefaultInputValue.Trim(); oChoice.InputValue = oChoice.DefaultInputValue.Trim(); } m_DynamicControls.Add(new DynamicControl() { Control = this.memoEdit1, Name = this.memoEdit1.Name, DefaultTextValue = _DefaultValue, TextPrefix = oChoice.TextPrefix }); memoEdit1.TextChanged += new EventHandler(textEdit1_TextChanged); memoEdit1.Resize += new EventHandler(memoEdit1_Resize); memoEdit1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlItem1.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.layoutControlItem1.Control = this.memoEdit1; if (!string.IsNullOrEmpty(oChoice.TextPrefix)) { this.layoutControlItem1.Text = oChoice.TextPrefix; this.layoutControlItem1.TextVisible = true; this.layoutControlItem1.TextLocation = DevExpress.Utils.Locations.Top; this.layoutControlItem1.MaxSize = new Size(0, 41); this.layoutControlItem1.MinSize = new Size(0, 41); } else { this.layoutControlItem1.TextVisible = false; this.layoutControlItem1.MaxSize = new Size(0, 24); this.layoutControlItem1.MinSize = new Size(0, 24); } this.layoutControlItem1.SizeConstraintsType = SizeConstraintsType.Custom; this.layoutControlItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem1); idx++; } } } //string prioText = oSettings.Priority; //if (oSettings.CustomerOwnership && oSettings.BVOwnership) { // prioText += "(Cust+BV)"; //} else if (oSettings.CustomerOwnership) { // prioText += "(Cust)"; //} else if (oSettings.BVOwnership) { // prioText += "(BV)"; //} //if (oSettings.PlotDoneStatus.Trim().ToLower() == "done") { // prioText += " Done"; //} // simpleLabelItem1 //this.simpleLabelItem1 = new DevExpress.XtraLayout.SimpleLabelItem(); //this.simpleLabelItem1.Name = "simpleLabelItem" + Guid.NewGuid().ToString(); //this.simpleLabelItem1.AppearanceItemCaption.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); //this.simpleLabelItem1.AppearanceItemCaption.Options.UseTextOptions = true; //this.simpleLabelItem1.ShowInCustomizationForm = false; //this.simpleLabelItem1.Text = prioText; //this.simpleLabelItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); //this.layoutControlGroupQuestion1.AddItem(this.simpleLabelItem1); //if (!string.IsNullOrEmpty(oSettings.QuestionHelp)) { // // LabelControl1 help // this.labelControl1 = new DevExpress.XtraEditors.LabelControl(); // this.labelControl1.Name = "labelControl" + Guid.NewGuid().ToString(); // this.labelControl1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); // this.labelControl1.Appearance.Options.UseTextOptions = true; // this.labelControl1.Text = "Help"; // this.labelControl1.ToolTip = oSettings.QuestionHelp.Trim(); // //apply tooltip controller from parent // if (this.ToolTipController != null && this.ToolTipController.DefaultController != null) { // this.labelControl1.ToolTipController = ToolTipController.DefaultController; // } // this.labelControl1.Click += new EventHandler(layoutControlGroupQuestion1_Click); // //layoutControlItem1 // this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); // this.layoutControlItem1.Name = "layoutControlItem" + Guid.NewGuid().ToString(); // this.layoutControlItem1.Control = this.labelControl1; // this.layoutControlItem1.TextVisible = false; // this.layoutControlItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); // this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem1, this.simpleLabelItem1, DevExpress.XtraLayout.Utils.InsertType.Right); //} this.layoutControlGroupQuestion1.Click += new EventHandler(layoutControlGroupQuestion1_Click); /* * https://brightvision.jira.com/browse/PLATFORM-2440 */ for (int i = 0; i < this.layoutControlGroupQuestion1.Items.Count; i++) { ((LayoutControlItem)this.layoutControlGroupQuestion1.Items[i]).ControlMinSize = new Size(refColItemWidth, 17); } this.layoutControlGroupQuestion1.EndUpdate(); Image bg = BGImage(this); if (bg != null) { this.layoutControlGroupQuestion1.BackgroundImage = bg; this.layoutControlGroupQuestion1.BackgroundImageVisible = true; } if (this.memoEdit1 != null) this.BackColor = this.memoEdit1.BackColor; this.ControlGroup = this.layoutControlGroupQuestion1; this.ControlGroup.Tag = this; isLoaded = true; }
public void BindControls() { if (Questionnaire == null) { BrightVision.Common.UI.NotificationDialog.Information("Drop Box", "Questionnaire must be initialized with Json first."); return; } isLoaded = false; this.layoutControlGroupQuestion1.Clear(); Settings oSettings = Questionnaire.Form.Settings; m_DynamicControls = new List<DynamicControl>(); this.layoutControlGroupQuestion1.Name = "layoutControlGroupQuestion" + Guid.NewGuid().ToString(); this.layoutControlGroupQuestion1.AppearanceGroup.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); this.layoutControlGroupQuestion1.AppearanceGroup.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical; this.layoutControlGroupQuestion1.AppearanceGroup.Options.UseFont = true; this.layoutControlGroupQuestion1.ExpandButtonVisible = false; this.layoutControlGroupQuestion1.GroupBordersVisible = true; this.layoutControlGroupQuestion1.TextVisible = false; //this.layoutControlGroupQuestion1.Location = new System.Drawing.Point(0, 0); this.layoutControlGroupQuestion1.Padding = new DevExpress.XtraLayout.Utils.Padding(1, 1, 1, 1); this.layoutControlGroupQuestion1.ShowInCustomizationForm = false; //this.layoutControlGroupQuestion1.Text = oSettings.Label + " " + oSettings.QuestionText; this.layoutControlGroupQuestion1.BeginUpdate(); #region Footer this.layoutControlItem1 = new LayoutControlItem(); this.layoutControlItem1.Name = "layoutControlItem" + Guid.NewGuid().ToString(); //bool isCustomerOwned = false; //bool isBrightvisionOwned = false; //if (oSettings.CustomerOwnership && oSettings.BVOwnership) // isCustomerOwnershipOnly = true; //ctlFooter = new Footer() { // IsAccountLevel = oSettings.DataBindings.account_level, // IsCustomerOwnershipOnly = isCustomerOwnershipOnly, // HelpText = oSettings.QuestionHelp, // LanguageCode = oSettings.DataBindings.language_code //}; ctlFooter = new Footer() { IsAccountLevel = oSettings.DataBindings.account_level, IsCustomerOwned = oSettings.CustomerOwnership, IsBrightvisionOwned = oSettings.BVOwnership, HelpText = oSettings.QuestionHelp, LanguageCode = oSettings.DataBindings.language_code, QuestionText = String.Format("{0} {1}", oSettings.Label, oSettings.QuestionText) }; ctlFooter.InitializeFooter(); ctlFooter.Dock = DockStyle.Fill; ctlFooter.Height = 20; this.layoutControlItem1.Control = ctlFooter; this.layoutControlItem1.ShowInCustomizationForm = false; this.layoutControlItem1.TextVisible = false; this.layoutControlItem1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); this.layoutControlItem1.MinSize = new Size(0, 24); this.layoutControlItem1.MaxSize = new Size(0, 24); this.layoutControlItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlItem1.SizeConstraintsType = SizeConstraintsType.Custom; this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem1); #endregion IList<AnswerOption> answeroptionList = Questionnaire.Form.Settings.AnswerOptions; IDropbox answeroption = null; int iAnswerOptions = answeroptionList.Count; System.Drawing.Size newSize; int selectedIndex = 0; for (int x = 0; x < iAnswerOptions; ++x) { answeroption = answeroptionList[x] as IDropbox; // simpleLabelItem1 this.simpleLabelItem1 = new DevExpress.XtraLayout.SimpleLabelItem(); this.simpleLabelItem1.Name = "simpleLabelItem" + Guid.NewGuid().ToString(); this.simpleLabelItem1.ShowInCustomizationForm = false; this.simpleLabelItem1.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; this.simpleLabelItem1.Text = answeroption.TextPrefix; //this.simpleLabelItem1.SizeConstraintsType = SizeConstraintsType.Custom; //this.simpleLabelItem1.MaxSize = new System.Drawing.Size(0, 10); //this.simpleLabelItem1.MinSize = new System.Drawing.Size(5, 10); //this.simpleLabelItem1.Size = new System.Drawing.Size(5, 10); this.simpleLabelItem1.AppearanceItemCaption.BackColor = System.Drawing.Color.Transparent; this.simpleLabelItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.simpleLabelItem1); // layoutControlItem1 this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); // comboBox1 this.comboBoxEdit1 = new ComboBoxEdit(); this.comboBoxEdit1.Tag = new DropboxData() { PositionIndex = "IndexPosition" + x, ControlContainer = layoutControlItem1, Required = answeroption.SelectionValueRequired, HasValue = !string.IsNullOrWhiteSpace(answeroption.DefaultSelectionValue) ? true : false }; this.comboBoxEdit1.Name = "comboBox" + Guid.NewGuid().ToString(); this.comboBoxEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; this.comboBoxEdit1.SelectedIndexChanged += new EventHandler(comboBoxEdit1_SelectedIndexChanged); this.comboBoxEdit1.Click += new EventHandler(layoutControlGroupQuestion1_Click); List<string> dropboxvalues = answeroption.DropBoxValues; var colItems = this.comboBoxEdit1.Properties.Items; dropboxvalues.ForEach(delegate(string value) { colItems.Add(value); }); if (answeroption.DefaultSelectionValue != null) { selectedIndex = dropboxvalues.IndexOf(answeroption.DefaultSelectionValue.Trim()); answeroption.SelectionValue = answeroption.DefaultSelectionValue.Trim(); } m_DynamicControls.Add(new DynamicControl() { Control = this.comboBoxEdit1, Name = this.comboBoxEdit1.Name, DefaultValue = selectedIndex.ToString(), TextPrefix = answeroption.TextPrefix }); this.comboBoxEdit1.SelectedIndex = selectedIndex; this.layoutControlItem1.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.layoutControlItem1.Control = this.comboBoxEdit1; //this.layoutControlItem1.MinSize = new Size(150, 24); //this.layoutControlItem1.MaxSize = new Size(250, 24); //if (!string.IsNullOrEmpty(answeroption.DropboxMaxWidth)) { // newSize = new System.Drawing.Size(int.Parse(answeroption.DropboxMaxWidth), 24); // this.layoutControlItem1.Size = newSize; //} else { // this.layoutControlItem1.Size = new Size(80, 24); //} if (answeroption.SelectionValueIfOtherVisible) { this.layoutControlItem1.SizeConstraintsType = SizeConstraintsType.Custom; this.layoutControlItem1.MaxSize = new Size(150, 24); this.layoutControlItem1.MinSize = new Size(80, 24); } //else { // this.layoutControlItem1.MaxSize = new Size(0, 24); // this.layoutControlItem1.MinSize = new Size(0, 24); //} //if (!string.IsNullOrEmpty(answeroption.TextPrefix)) { // this.layoutControlItem1.Text = answeroption.TextPrefix; // this.layoutControlItem1.TextVisible = true; // this.layoutControlItem1.AppearanceItemCaption.TextOptions.HAlignment = HorzAlignment.Far; //} else { // this.layoutControlItem1.TextVisible = false; //} this.layoutControlItem1.TextVisible = false; this.layoutControlItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem1, this.simpleLabelItem1, DevExpress.XtraLayout.Utils.InsertType.Right); if (answeroption.SelectionValueIfOtherVisible) { // layoutControlItem2 this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem(); //add textEdit1 to layout this.textEdit1 = new TextEdit(); this.textEdit1.Tag = new DropboxData() { PositionIndex = "IndexPosition" + x, ControlContainer = layoutControlItem2, Required = answeroption.SelectionValueIfOtherRequired, HasValue = (!string.IsNullOrWhiteSpace(answeroption.DefaultSelectionValueIfOther) ? true : false) }; this.textEdit1.Name = "textEdit" + Guid.NewGuid().ToString(); this.textEdit1.StyleController = this.StyleController; textEdit1.TextChanged += new EventHandler(textEdit1_TextChanged); textEdit1.Click += new EventHandler(layoutControlGroupQuestion1_Click); //if (!string.IsNullOrEmpty(answeroption.DefaultSelectionValueIfOther)) { // this.textEdit1.Text = answeroption.DefaultSelectionValueIfOther.Trim(); //}else if (!string.IsNullOrEmpty(answeroption.SelectionValueIfOther)) { // this.textEdit1.Text = answeroption.SelectionValueIfOther.Trim(); //} string _DefaultValue = string.Empty; if (answeroption.DefaultSelectionValueIfOther != null) { _DefaultValue = answeroption.DefaultSelectionValueIfOther.Trim(); this.textEdit1.Text = answeroption.DefaultSelectionValueIfOther.Trim(); answeroption.SelectionValueIfOther = this.textEdit1.Text; } m_DynamicControls.Add(new DynamicControl() { Control = this.textEdit1, Name = this.textEdit1.Name, DefaultValue = _DefaultValue, TextPrefix = answeroption.TextPrefix }); this.layoutControlItem2.SizeConstraintsType = SizeConstraintsType.Custom; newSize = new System.Drawing.Size(350, 24); this.layoutControlItem2.Size = newSize; this.layoutControlItem2.MaxSize = new Size(350, 24); this.layoutControlItem2.MinSize = new Size(150, 24); //this.layoutControlItem2.SizeConstraintsType = SizeConstraintsType.Custom; //this.layoutControlItem2.MaxSize = new Size(250, 24); this.layoutControlItem2.Control = this.textEdit1; this.layoutControlItem2.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.layoutControlItem2.TextToControlDistance = 0; this.layoutControlItem2.TextVisible = false; this.layoutControlItem2.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem2, this.layoutControlItem1, DevExpress.XtraLayout.Utils.InsertType.Right); } } //string prioText = oSettings.Priority; //if (oSettings.CustomerOwnership && oSettings.BVOwnership) { // prioText += "(Cust+BV)"; //} else if (oSettings.CustomerOwnership) { // prioText += "(Cust)"; //} else if (oSettings.BVOwnership) { // prioText += "(BV)"; //} //if (oSettings.PlotDoneStatus.Trim().ToLower() == "done") { // prioText += " Done"; //} //// simpleLabelItem1 status //this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); //this.emptySpaceItem1.Name = "simpleLabelItem" + Guid.NewGuid().ToString(); //this.emptySpaceItem1.AppearanceItemCaption.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); //this.emptySpaceItem1.AppearanceItemCaption.Options.UseTextOptions = true; //this.emptySpaceItem1.ShowInCustomizationForm = false; //this.emptySpaceItem1.SizeConstraintsType = SizeConstraintsType.Custom; //this.emptySpaceItem1.Text = prioText; //this.emptySpaceItem1.TextVisible = true; //this.emptySpaceItem1.Size = new Size(10, 20); //this.emptySpaceItem1.MaxSize = new Size(0, 20); //this.emptySpaceItem1.MinSize = new Size(0, 20); //this.emptySpaceItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); //this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem1); //if (!string.IsNullOrEmpty(oSettings.QuestionHelp)) { // this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem(); // this.emptySpaceItem2.Name = "simpleLabelItem" + Guid.NewGuid().ToString(); // this.emptySpaceItem2.AppearanceItemCaption.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); // this.emptySpaceItem2.AppearanceItemCaption.Options.UseTextOptions = true; // this.emptySpaceItem2.ShowInCustomizationForm = false; // this.emptySpaceItem2.Text = "Help"; // this.emptySpaceItem2.OptionsToolTip.ToolTip = oSettings.QuestionHelp.Trim(); // //apply tooltip controller from parent // //if (this.ToolTipController != null && this.ToolTipController.DefaultController != null) { // // this.emptySpaceItem2.OptionsToolTip.ToolTipController = ToolTipController.DefaultController; // //} // this.emptySpaceItem2.TextVisible = true; // this.emptySpaceItem2.Size = new Size(50, 20); // this.emptySpaceItem2.MaxSize = new Size(50, 20); // this.emptySpaceItem2.MinSize = new Size(50, 20); // this.emptySpaceItem2.SizeConstraintsType = SizeConstraintsType.Custom; // this.emptySpaceItem2.Click += new EventHandler(layoutControlGroupQuestion1_Click); // this.emptySpaceItem2.AppearanceItemCaption.TextOptions.HAlignment = HorzAlignment.Far; // this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem2, this.emptySpaceItem1, DevExpress.XtraLayout.Utils.InsertType.Right); //} this.layoutControlGroupQuestion1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.EndUpdate(); Image bg = BGImage(this); if (bg != null) { this.layoutControlGroupQuestion1.BackgroundImage = bg; this.layoutControlGroupQuestion1.BackgroundImageVisible = true; } if (this.textEdit1 != null) BackColor = this.textEdit1.BackColor; this.ControlGroup = this.layoutControlGroupQuestion1; this.ControlGroup.Tag = this; isLoaded = true; }
/* * https://brightvision.jira.com/browse/PLATFORM-3015 */ public void BindControls() { #region Initialization if (Questionnaire == null) MessageBox.Show("Questionnaire must be bind with JSON first.", "Schedule Component"); var answerOpt = Questionnaire.Form.Settings.AnswerOptions[0] as ISchedule; //if (CalendarDataSource == null) { // if (answerOpt != null) { // if (answerOpt.CalendarOption != null && answerOpt.CalendarOption.CalendarValues.Count > 0) // CalendarDataSource = answerOpt.CalendarOption.CalendarValues; // else { // MessageBox.Show("\"CalendarDataSource\" property must be set first.","Schedule Component"); // return; // } // } else { // MessageBox.Show("\"CalendarDataSource\" property must be set first.", "Schedule Component"); // return; // } //} #endregion isLoaded = false; this.layoutControlGroupQuestion1.Clear(); Settings oSettings = Questionnaire.Form.Settings; // layoutControlGroupQuestion1 this.layoutControlGroupQuestion1.Name = "layoutControlGroupQuestion" + Guid.NewGuid().ToString(); this.layoutControlGroupQuestion1.AppearanceGroup.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); this.layoutControlGroupQuestion1.AppearanceGroup.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical; this.layoutControlGroupQuestion1.AppearanceGroup.Options.UseFont = true; this.layoutControlGroupQuestion1.ExpandButtonVisible = false; this.layoutControlGroupQuestion1.GroupBordersVisible = true; this.layoutControlGroupQuestion1.TextVisible = false; this.layoutControlGroupQuestion1.Padding = new DevExpress.XtraLayout.Utils.Padding(1, 1, 1, 1); this.layoutControlGroupQuestion1.ShowInCustomizationForm = false; //this.layoutControlGroupQuestion1.Text = oSettings.Label + " " + oSettings.QuestionText; this.layoutControlGroupQuestion1.BeginUpdate(); #region Footer this.lciFooter = new LayoutControlItem(); this.lciFooter.Name = "layoutControlItem" + Guid.NewGuid().ToString(); //bool isCustomerOwnershipOnly = false; //if (oSettings.CustomerOwnership && oSettings.BVOwnership) // isCustomerOwnershipOnly = true; //ctlFooter = new Footer() { // IsAccountLevel = oSettings.DataBindings.account_level, // IsCustomerOwnershipOnly = isCustomerOwnershipOnly, // HelpText = oSettings.QuestionHelp, // LanguageCode = oSettings.DataBindings.language_code //}; ctlFooter = new Footer() { IsAccountLevel = oSettings.DataBindings.account_level, IsCustomerOwned = oSettings.CustomerOwnership, IsBrightvisionOwned = oSettings.BVOwnership, HelpText = oSettings.QuestionHelp, LanguageCode = oSettings.DataBindings.language_code, QuestionText = oSettings.Label + " " + oSettings.QuestionText }; ctlFooter.InitializeFooter(); ctlFooter.Dock = DockStyle.Fill; ctlFooter.Height = 20; this.lciFooter.Control = ctlFooter; this.lciFooter.ShowInCustomizationForm = false; this.lciFooter.TextVisible = false; this.lciFooter.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); this.lciFooter.MinSize = new Size(0, 24); this.lciFooter.MaxSize = new Size(0, 24); this.lciFooter.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.lciFooter.SizeConstraintsType = SizeConstraintsType.Custom; this.layoutControlGroupQuestion1.AddItem(this.lciFooter); #endregion IList<AnswerOption> answeroptionList = Questionnaire.Form.Settings.AnswerOptions; ISchedule answeroption = null; int iAnswerOptions = answeroptionList.Count; //System.Drawing.Size newSize; int idx = 0; ScheduleSalesPerson oSalesPerson; for (int x = 0; x < iAnswerOptions; ++x) { answeroption = answeroptionList[x] as ISchedule; LayoutControlItem lciScheduleDetails = new LayoutControlItem(); this.lblScheduleDetails = new Label(); this.lblScheduleDetails.Text = ""; lciScheduleDetails.Control = this.lblScheduleDetails; lciScheduleDetails.TextVisible = false; this.layoutControlGroupQuestion1.AddItem(lciScheduleDetails); #region Sales Person // layoutControlItem1 this.lciSalesPerson = new LayoutControlItem(); //lookUpEdit1 this.lookUpEdit1 = new LookUpEdit(); this.lookUpEdit1.Name = "SalesPerson_lookUpEdit" + Guid.NewGuid().ToString(); this.lookUpEdit1.Properties.NullText = ""; //this.lookUpEdit1.Properties.DisplayMember = "Name"; //this.lookUpEdit1.Properties.ValueMember = "Id"; this.lookUpEdit1.Properties.DisplayMember = "resource_name"; this.lookUpEdit1.Properties.ValueMember = "resource_id"; //this.lookUpEdit1.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Name", "SalesPerson")); this.lookUpEdit1.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("resource_name", "SalesPerson")); this.lookUpEdit1.Properties.ShowFooter = false; this.lookUpEdit1.Properties.ShowHeader = false; this.lookUpEdit1.Properties.ReadOnly = true; this.lookUpEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; oSalesPerson = answeroption.ScheduleSalesPerson; if (oSalesPerson != null) { if (oSalesPerson.SalesPersonSelectedValue != null) { this.lookUpEdit1.Properties.DataSource = new List<SalesPerson> { oSalesPerson.SalesPersonSelectedValue }; this.lookUpEdit1.EditValue = oSalesPerson.SalesPersonSelectedValue.Id; } } this.lookUpEdit1.Tag = new ScheduleData() { Name = "SalesPerson", PositionIndex = "IndexPosition" + x, ControlContainer = lciSalesPerson }; this.lookUpEdit1.Size = new System.Drawing.Size(155, 20); this.lookUpEdit1.StyleController = this.StyleController; //this.lookUpEdit1.EditValueChanged += new EventHandler(lookUpEdit1_SelectedIndexChanged); this.lookUpEdit1.Click += new EventHandler(layoutControlGroupQuestion1_Click); // lciSalesPerson this.lciSalesPerson.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.lciSalesPerson.Control = this.lookUpEdit1; if (oSalesPerson != null && !string.IsNullOrEmpty(oSalesPerson.TextPrefix)) { this.lciSalesPerson.Text = oSalesPerson.TextPrefix.Trim(); } else { this.lciSalesPerson.Text = "Sales Person:"; } this.lciSalesPerson.TextLocation = DevExpress.Utils.Locations.Top; this.lciSalesPerson.TextSize = new System.Drawing.Size(108, 13); this.lciSalesPerson.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.lciSalesPerson.MaxSize = new System.Drawing.Size(160, 20); this.lciSalesPerson.MinSize = new System.Drawing.Size(160, 20); this.lciSalesPerson.Size = new System.Drawing.Size(50, 20); this.lciSalesPerson.ShowInCustomizationForm = false; this.lciSalesPerson.Click += new EventHandler(layoutControlGroupQuestion1_Click); //this.layoutControlGroupQuestion1.AddItem(this.lciSalesPerson); #endregion #region Schedule Type // emptySpaceItem1 this.emptySpaceItem1 = new EmptySpaceItem(); this.emptySpaceItem1.Name = "emptySpaceItem" + Guid.NewGuid().ToString(); this.emptySpaceItem1.Size = new System.Drawing.Size(25, 20); this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); this.emptySpaceItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.emptySpaceItem1.MaxSize = new System.Drawing.Size(0, 20); this.emptySpaceItem1.MinSize = new System.Drawing.Size(0, 20); this.emptySpaceItem1.ShowInCustomizationForm = false; this.emptySpaceItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); // // comboBoxEdit1 this.lciScheduleType = new DevExpress.XtraLayout.LayoutControlItem(); this.comboBoxEdit1 = new ComboBoxEdit(); this.comboBoxEdit1.Tag = new ScheduleData() { Name = "ScheduleType", PositionIndex = "IndexPosition" + x, ControlContainer = lciScheduleType }; this.comboBoxEdit1.Size = new System.Drawing.Size(50, 20); this.comboBoxEdit1.Name = "ScheduleType_comboBoxEdit" + Guid.NewGuid().ToString(); this.comboBoxEdit1.Properties.ReadOnly = true; this.comboBoxEdit1.StyleController = this.StyleController; this.comboBoxEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; this.comboBoxEdit1.SelectedIndexChanged += new EventHandler(comboBoxEdit1_SelectedIndexChanged); this.comboBoxEdit1.Click += new EventHandler(layoutControlGroupQuestion1_Click); if (answeroption.ScheduleType == null) { answeroption.ScheduleType = new ScheduleType(); } if (answeroption.ScheduleType.ScheduleTypeSelectedValue == null) { answeroption.ScheduleType.ScheduleTypeSelectedValue = ""; } answeroption.ScheduleType.ScheduleTypeValues = new List<string> { "Seminar", "Webinar", "Meeting" }; answeroption.ScheduleType.ScheduleTypeValues.ForEach(delegate(string strValue) { this.comboBoxEdit1.Properties.Items.Add(strValue); }); // lciScheduleType this.lciScheduleType.Name = "layoutControlItem" + Guid.NewGuid().ToString(); //this.layoutControlItem2.AppearanceItemCaption.Options.UseTextOptions = true; //this.layoutControlItem2.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; this.lciScheduleType.Control = this.comboBoxEdit1; this.lciScheduleType.TextLocation = DevExpress.Utils.Locations.Top; this.lciScheduleType.TextSize = new System.Drawing.Size(60, 13); if (!string.IsNullOrEmpty(answeroption.ScheduleType.TextPrefix)) { this.lciScheduleType.Text = answeroption.ScheduleType.TextPrefix; } else { this.lciScheduleType.Text = "Schedule Type:"; } this.lciScheduleType.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.lciScheduleType.MaxSize = new System.Drawing.Size(160, 24); this.lciScheduleType.MinSize = new System.Drawing.Size(160, 24); this.lciScheduleType.Size = new System.Drawing.Size(160, 24); this.lciScheduleType.ShowInCustomizationForm = false; this.lciScheduleType.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.lciSalesPerson.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization; this.lciScheduleType.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization; this.emptySpaceItem1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization; this.layoutControlGroupQuestion1.AddItem(this.lciScheduleType); this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem1, this.lciScheduleType, DevExpress.XtraLayout.Utils.InsertType.Right); this.layoutControlGroupQuestion1.AddItem(this.lciSalesPerson, this.emptySpaceItem1, DevExpress.XtraLayout.Utils.InsertType.Right); // emptySpaceItem1 this.emptySpaceItem1 = new EmptySpaceItem(); this.emptySpaceItem1.Name = "emptySpaceItem" + Guid.NewGuid().ToString(); this.emptySpaceItem1.Size = new System.Drawing.Size(1, 15); this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); this.emptySpaceItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.emptySpaceItem1.MaxSize = new System.Drawing.Size(0, 15); this.emptySpaceItem1.MinSize = new System.Drawing.Size(0, 15); this.emptySpaceItem1.ShowInCustomizationForm = false; this.emptySpaceItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); //this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem1); #endregion #region List of Schedules Available // lciListOfSchedule this.lciListOfScheduleDropDown = new DevExpress.XtraLayout.LayoutControlItem(); //lookUpEdit1 this.lookUpEdit2 = new LookUpEdit(); this.lookUpEdit2.Name = "lookUpEdit" + Guid.NewGuid().ToString(); this.lookUpEdit2.Properties.NullText = ""; this.lookUpEdit2.Properties.DisplayMember = "title"; this.lookUpEdit2.Properties.ValueMember = "id"; this.lookUpEdit2.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("title", "List of Bookings")); comboBoxEdit1_SelectedIndexChanged(this.comboBoxEdit1, null); this.lookUpEdit2.Properties.ShowFooter = true; this.lookUpEdit2.Properties.ShowHeader = false; this.lookUpEdit2.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; this.lookUpEdit2.Tag = new ScheduleData() { Name = "ListOfBookingsAvailable", PositionIndex = "IndexPosition" + x, ControlContainer = lciListOfScheduleDropDown, Required = answeroption.ListOfBookingsAvailableRequired, HasValue = answeroption.ScheduleValue != null && !string.IsNullOrEmpty(answeroption.ScheduleValue.ScheduleId) ? true : false }; this.lookUpEdit2.Size = new System.Drawing.Size(155, 20); this.lookUpEdit2.StyleController = this.StyleController; //load answer values if (answeroption.ScheduleType != null) { if (answeroption.ScheduleValue != null) { if (!string.IsNullOrEmpty(answeroption.ScheduleValue.ScheduleId)) { int schedid = int.Parse(answeroption.ScheduleValue.ScheduleId); lookUpEdit2.EditValue = schedid; //if (answeroption.ScheduleType.ScheduleTypeSelectedValue.ToLower() == "meeting") { // CreateMeeting.Enabled = true; //} } } } //this.lookUpEdit2.EditValueChanged += new EventHandler(lookUpEdit2_EditValueChanged); this.lookUpEdit2.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.comboBoxEdit1.EditValue = answeroption.ScheduleType.ScheduleTypeSelectedValue; // layoutControlItem1 this.lciListOfScheduleDropDown.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.lciListOfScheduleDropDown.Control = this.lookUpEdit2; if (!string.IsNullOrEmpty(answeroption.ListOfBookingsAvailableLabel)) { this.lciListOfScheduleDropDown.Text = answeroption.ListOfBookingsAvailableLabel.Trim(); } else { this.lciListOfScheduleDropDown.Text = "List of Schedules Available:"; } this.lciListOfScheduleDropDown.TextLocation = DevExpress.Utils.Locations.Top; this.lciListOfScheduleDropDown.ShowInCustomizationForm = false; this.lciListOfScheduleDropDown.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.lciListOfScheduleDropDown.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization; this.layoutControlGroupQuestion1.AddItem(this.lciListOfScheduleDropDown); // // simpleButton1 // this.PreviewBooking = new SimpleButton(); //this.PreviewBooking.Name = "PreviewDetails_simpleButton" + Guid.NewGuid().ToString(); this.PreviewBooking.Name = "PreviewBooking"; this.PreviewBooking.Size = new System.Drawing.Size(130, 22); this.PreviewBooking.StyleController = this.StyleController; if (!string.IsNullOrEmpty(answeroption.ViewDetailSummaryButtonLabel)) this.PreviewBooking.Text = answeroption.ViewDetailSummaryButtonLabel; else this.PreviewBooking.Text = "Preview Details"; this.PreviewBooking.Click += new EventHandler(viewDetailSummary_Click); this.PreviewBooking.Enabled = false; // lciListOfSchedulePreviewButton this.lciListOfSchedulePreviewButton = new LayoutControlItem(); this.lciListOfSchedulePreviewButton.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.lciListOfSchedulePreviewButton.Control = this.PreviewBooking; this.lciListOfSchedulePreviewButton.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.lciListOfSchedulePreviewButton.MaxSize = new System.Drawing.Size(100, 24); this.lciListOfSchedulePreviewButton.MinSize = new System.Drawing.Size(80, 24); this.lciListOfSchedulePreviewButton.Size = new System.Drawing.Size(80, 24); this.lciListOfSchedulePreviewButton.TextVisible = false; this.lciListOfSchedulePreviewButton.ShowInCustomizationForm = false; this.lciListOfSchedulePreviewButton.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.lciListOfSchedulePreviewButton); // // simpleButton1 // this.CreateMeeting = new SimpleButton(); //this.CreateMeeting.Name = "CreateMeeting_simpleButton" + Guid.NewGuid().ToString(); this.CreateMeeting.Name = "CreateMeeting"; this.CreateMeeting.Size = new System.Drawing.Size(130, 22); this.CreateMeeting.StyleController = this.StyleController; if (!string.IsNullOrEmpty(answeroption.CreateMeetingButtonLabel)) { if (answeroption.CreateMeetingButtonLabel.Trim().ToLower() == "create meeting") { this.CreateMeeting.Text = "Create/Edit Meeting"; } else { this.CreateMeeting.Text = answeroption.CreateMeetingButtonLabel; } } else { this.CreateMeeting.Text = "Create/Edit Meeting"; } this.CreateMeeting.Click += new EventHandler(createMeeting_Click); this.CreateMeeting.Enabled = false; // layoutControlItem1 this.lciListOfScheduleCreateEditButton = new LayoutControlItem(); if (answeroption.ScheduleType != null && answeroption.ScheduleType.ScheduleTypeSelectedValue == "Meeting") { //lookUpEdit2.Properties.ReadOnly = true; this.CreateMeeting.Tag = "HasMeeting"; } else this.lciListOfScheduleCreateEditButton.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; //this.lciListOfScheduleCreateEditButton.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.lciListOfScheduleCreateEditButton.Name = "lciListOfScheduleCreateEditButton"; this.lciListOfScheduleCreateEditButton.Control = this.CreateMeeting; this.lciListOfScheduleCreateEditButton.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.lciListOfScheduleCreateEditButton.MaxSize = new System.Drawing.Size(115, 24); this.lciListOfScheduleCreateEditButton.MinSize = new System.Drawing.Size(115, 24); this.lciListOfScheduleCreateEditButton.Size = new System.Drawing.Size(115, 24); this.lciListOfScheduleCreateEditButton.TextVisible = false; this.lciListOfScheduleCreateEditButton.ShowInCustomizationForm = false; this.lciListOfScheduleCreateEditButton.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.lciListOfScheduleCreateEditButton, this.lciListOfSchedulePreviewButton, DevExpress.XtraLayout.Utils.InsertType.Right); // // simpleButton1 // this.DeleteMeeting = new SimpleButton(); //this.DeleteMeeting.Name = "DeleteMeeting_simpleButton" + Guid.NewGuid().ToString(); this.DeleteMeeting.Name = "DeleteMeeting"; this.DeleteMeeting.Size = new System.Drawing.Size(130, 22); this.DeleteMeeting.StyleController = this.StyleController; this.DeleteMeeting.Text = "Delete Meeting"; this.DeleteMeeting.Click += new EventHandler(deleteMeeting_Click); this.DeleteMeeting.Enabled = false; // lciListOfScheduleDeleteButton this.lciListOfScheduleDeleteButton = new LayoutControlItem(); if (answeroption.ScheduleType != null && answeroption.ScheduleType.ScheduleTypeSelectedValue == "Meeting") { this.DeleteMeeting.Tag = "HasMeeting"; //lookUpEdit2.Properties.ReadOnly = true; var lueData = lookUpEdit2.Tag as ScheduleData; lueData.IsMeeting = true; } else this.lciListOfScheduleDeleteButton.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; this.lciListOfScheduleDeleteButton.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.lciListOfScheduleDeleteButton.Control = this.DeleteMeeting; this.lciListOfScheduleDeleteButton.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.lciListOfScheduleDeleteButton.MaxSize = new System.Drawing.Size(100, 24); this.lciListOfScheduleDeleteButton.MinSize = new System.Drawing.Size(80, 24); this.lciListOfScheduleDeleteButton.Size = new System.Drawing.Size(80, 24); this.lciListOfScheduleDeleteButton.TextVisible = false; this.lciListOfScheduleDeleteButton.ShowInCustomizationForm = false; this.lciListOfScheduleDeleteButton.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.lciListOfScheduleDeleteButton, this.lciListOfScheduleCreateEditButton, DevExpress.XtraLayout.Utils.InsertType.Right); ////load answer values //if (answeroption.ScheduleType != null) { // if (answeroption.ScheduleValue != null) { // if (!string.IsNullOrEmpty(answeroption.ScheduleValue.ScheduleId)) { // int schedid = int.Parse(answeroption.ScheduleValue.ScheduleId); // lookUpEdit2.EditValue = schedid; // //if (answeroption.ScheduleType.ScheduleTypeSelectedValue.ToLower() == "meeting") { // // CreateMeeting.Enabled = true; // //} // } // } //} // emptySpaceItem1 this.emptySpaceItem1 = new EmptySpaceItem(); this.emptySpaceItem1.Name = "emptySpaceItem" + Guid.NewGuid().ToString(); this.emptySpaceItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.emptySpaceItem1.MaxSize = new System.Drawing.Size(0, 20); this.emptySpaceItem1.MinSize = new System.Drawing.Size(0, 20); this.emptySpaceItem1.Size = new System.Drawing.Size(200, 20); this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); this.emptySpaceItem1.ShowInCustomizationForm = false; this.emptySpaceItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem1, this.lciListOfScheduleDeleteButton, DevExpress.XtraLayout.Utils.InsertType.Right); #endregion #region Customer Attendies #region Grid simpleLabelItemValidation = new SimpleLabelItem(); simpleLabelItemValidation.AppearanceItemCaption.BackColor = Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128))))); simpleLabelItemValidation.Name = Guid.NewGuid().ToString(); simpleLabelItemValidation.TextAlignMode = TextAlignModeItem.CustomSize; simpleLabelItemValidation.TextSize = new Size(212, 20); simpleLabelItemValidation.Text = " Please add at least one contact attendie."; simpleLabelItemValidation.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; this.layoutControlGroupQuestion1.AddItem(simpleLabelItemValidation); //create our gridcontrol // // gridColumn1 // this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn1.Caption = "Name"; this.gridColumn1.FieldName = "Name"; this.gridColumn1.Name = "gridColumn" + Guid.NewGuid().ToString(); this.gridColumn1.Visible = true; this.gridColumn1.OptionsColumn.AllowEdit = false; this.gridColumn1.VisibleIndex = 0; this.gridColumn1.Width = 66; // // gridColumn2 // this.gridColumn2 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn2.Caption = "Address"; this.gridColumn2.FieldName = "Address"; this.gridColumn2.Name = "gridColumn" + Guid.NewGuid().ToString(); this.gridColumn2.Visible = true; this.gridColumn2.OptionsColumn.AllowEdit = false; this.gridColumn2.VisibleIndex = 1; this.gridColumn2.Width = 66; // // gridColumn3 // //this.gridColumn3 = new DevExpress.XtraGrid.Columns.GridColumn(); //this.gridColumn3.Caption = "City"; //this.gridColumn3.FieldName = "City"; //this.gridColumn3.Name = "gridColumn" + Guid.NewGuid().ToString(); //this.gridColumn3.Visible = true; //this.gridColumn3.OptionsColumn.AllowEdit = false; //this.gridColumn3.VisibleIndex = 2; //this.gridColumn3.Width = 66; // // gridColumn4 // this.gridColumn4 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn4.Caption = "Telephone"; this.gridColumn4.FieldName = "Telephone"; this.gridColumn4.Name = "gridColumn" + Guid.NewGuid().ToString(); this.gridColumn4.Visible = true; this.gridColumn4.OptionsColumn.AllowEdit = false; this.gridColumn4.VisibleIndex = 3; this.gridColumn4.Width = 66; // // gridColumn5 // this.gridColumn5 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn5.Caption = "Email"; this.gridColumn5.FieldName = "Email"; this.gridColumn5.Name = "gridColumn" + Guid.NewGuid().ToString(); this.gridColumn5.Visible = true; this.gridColumn5.OptionsColumn.AllowEdit = false; this.gridColumn5.VisibleIndex = 4; this.gridColumn5.Width = 70; // // gridColumn6 // this.gridColumn6 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn6.Caption = "AccountID"; this.gridColumn6.FieldName = "AccountID"; this.gridColumn6.Name = "gridColumn" + Guid.NewGuid().ToString(); this.gridColumn6.Visible = false; // // gridColumn7 // this.gridColumn7 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn7.Caption = "ContactID"; this.gridColumn7.FieldName = "ContactID"; this.gridColumn7.Name = "gridColumn" + Guid.NewGuid().ToString(); this.gridColumn7.Visible = false; // // gridView1 // this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView(); this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { this.gridColumn1, this.gridColumn2, //this.gridColumn3, this.gridColumn4, this.gridColumn5, this.gridColumn6, this.gridColumn7}); this.gridView1.GridControl = this.gridControl1; this.gridView1.Name = "gridView" + Guid.NewGuid().ToString(); this.gridView1.OptionsFind.AlwaysVisible = false; this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false; this.gridView1.OptionsSelection.MultiSelect = true; this.gridView1.OptionsView.ShowGroupPanel = false; this.gridView1.OptionsView.ColumnAutoWidth = true; this.gridView1.DataSourceChanged += new EventHandler(gridView1_DataSourceChanged); // // gridControl1 // this.gridControl1 = new DevExpress.XtraGrid.GridControl(); this.gridControl1.LookAndFeel.UseDefaultLookAndFeel = false; this.gridControl1.MainView = this.gridView1; this.gridControl1.Name = "gridControl" + Guid.NewGuid().ToString(); this.gridControl1.Size = new System.Drawing.Size(150, 74); this.gridControl1.TabIndex = 11; this.gridControl1.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.gridView1}); SetCurrentAttendies(); var schedData = new ScheduleData() { Required = answeroption.AttendiesRequired }; if (gridView1.GridControl.DataSource != null) { List<ContactAttendie> gvDs = gridView1.GridControl.DataSource as List<ContactAttendie>; if (gvDs != null && gvDs.Count > 0) schedData.HasValue = true; } this.gridView1.Tag = schedData; // // lciGridControl // this.lciGridControl = new LayoutControlItem(); this.lciGridControl.Control = this.gridControl1; this.lciGridControl.Name = "layoutControlItem" + Guid.NewGuid().ToString(); if (!string.IsNullOrEmpty(answeroption.AttendiesLabel)) this.lciGridControl.Text = answeroption.AttendiesLabel; else this.lciGridControl.Text = "Attendies:"; this.lciGridControl.TextLocation = DevExpress.Utils.Locations.Top; this.lciGridControl.TextSize = new System.Drawing.Size(108, 13); this.lciGridControl.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.lciGridControl.MaxSize = new System.Drawing.Size(0, 90); this.lciGridControl.MinSize = new System.Drawing.Size(0, 90); this.lciGridControl.Size = new System.Drawing.Size(200, 90); this.lciGridControl.ShowInCustomizationForm = false; this.layoutControlGroupQuestion1.AddItem(this.lciGridControl); #endregion // // simpleButton1 // this.simpleButton1 = new SimpleButton(); this.simpleButton1.Name = "simpleButton" + Guid.NewGuid().ToString(); this.simpleButton1.Size = new System.Drawing.Size(130, 22); this.simpleButton1.StyleController = this.StyleController; this.simpleButton1.Enabled = false; if (!string.IsNullOrEmpty(answeroption.AddCallerButtonLabel)) this.simpleButton1.Text = answeroption.AddCallerButtonLabel; else this.simpleButton1.Text = "Add Caller"; this.simpleButton1.Click += new EventHandler(AddCaller_Click); // lciAddCaller this.lciAddCaller = new LayoutControlItem(); this.lciAddCaller.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.lciAddCaller.Control = this.simpleButton1; this.lciAddCaller.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.lciAddCaller.MaxSize = new System.Drawing.Size(80, 24); this.lciAddCaller.MinSize = new System.Drawing.Size(80, 24); this.lciAddCaller.Size = new System.Drawing.Size(80, 24); this.lciAddCaller.TextVisible = false; this.lciAddCaller.ShowInCustomizationForm = false; this.lciAddCaller.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.lciAddCaller); // // simpleButton2 // this.simpleButton2 = new SimpleButton(); this.simpleButton2.Name = "simpleButton" + Guid.NewGuid().ToString(); this.simpleButton2.Size = new System.Drawing.Size(130, 22); this.simpleButton2.StyleController = this.StyleController; this.simpleButton2.Enabled = false; if (!string.IsNullOrEmpty(answeroption.AddAdditionalAttendieButtonLabel)) this.simpleButton2.Text = answeroption.AddAdditionalAttendieButtonLabel; else this.simpleButton2.Text = "Add Additional"; this.simpleButton2.Click += new EventHandler(AddAdditional_Click); // layoutControlItem1 this.lciAddAdditional = new LayoutControlItem(); this.lciAddAdditional.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.lciAddAdditional.Control = this.simpleButton2; this.lciAddAdditional.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.lciAddAdditional.MaxSize = new System.Drawing.Size(100, 24); this.lciAddAdditional.MinSize = new System.Drawing.Size(80, 24); this.lciAddAdditional.Size = new System.Drawing.Size(80, 24); this.lciAddAdditional.TextVisible = false; this.lciAddAdditional.ShowInCustomizationForm = false; this.lciAddAdditional.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.lciAddAdditional, this.lciAddCaller, DevExpress.XtraLayout.Utils.InsertType.Right); // // simpleButton3 // this.simpleButton3 = new SimpleButton(); this.simpleButton3.Name = "simpleButton" + Guid.NewGuid().ToString(); this.simpleButton3.Size = new System.Drawing.Size(130, 22); this.simpleButton3.StyleController = this.StyleController; this.simpleButton3.Enabled = false; if (!string.IsNullOrEmpty(answeroption.DeleteAttendieButtonLabel)) this.simpleButton3.Text = answeroption.DeleteAttendieButtonLabel; else this.simpleButton3.Text = "Delete"; this.simpleButton3.Click += new EventHandler(DeleteAttendie_Click); // layoutControlItem2 this.lciDeleteCaller = new LayoutControlItem(); this.lciDeleteCaller.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.lciDeleteCaller.Control = this.simpleButton3; this.lciDeleteCaller.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.lciDeleteCaller.MaxSize = new System.Drawing.Size(70, 24); this.lciDeleteCaller.MinSize = new System.Drawing.Size(70, 24); this.lciDeleteCaller.Size = new System.Drawing.Size(70, 24); this.lciDeleteCaller.TextVisible = false; this.lciDeleteCaller.ShowInCustomizationForm = false; this.lciDeleteCaller.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.lciDeleteCaller, this.lciAddAdditional, DevExpress.XtraLayout.Utils.InsertType.Right); // emptySpaceItem1 this.emptySpaceItem1 = new EmptySpaceItem(); this.emptySpaceItem1.Name = "emptySpaceItem" + Guid.NewGuid().ToString(); this.emptySpaceItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.emptySpaceItem1.MaxSize = new System.Drawing.Size(0, 20); this.emptySpaceItem1.MinSize = new System.Drawing.Size(0, 20); this.emptySpaceItem1.Size = new System.Drawing.Size(200, 20); this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); this.emptySpaceItem1.ShowInCustomizationForm = false; this.emptySpaceItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem1, this.lciDeleteCaller, DevExpress.XtraLayout.Utils.InsertType.Right); #endregion #region Other Choices idx = 0; //EmptySpaceItem esitem = new EmptySpaceItem(); //esitem.Size = new Size(100, 20); //this.layoutControlGroupQuestion1.AddItem(esitem); foreach (OtherChoice oChoice in answeroption.OtherChoices) { if (oChoice.Enabled) { //if (!string.IsNullOrEmpty(oChoice.TextPrefix)) { // // simpleLabelItem1 // this.simpleLabelItem1 = new DevExpress.XtraLayout.SimpleLabelItem(); // this.simpleLabelItem1.Name = "simpleLabelItem" + Guid.NewGuid().ToString(); // //this.simpleLabelItem1.ShowInCustomizationForm = false; // //this.simpleLabelItem1.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; // this.simpleLabelItem1.Text = oChoice.TextPrefix; // //newSize = new System.Drawing.Size(100, 20); // newSize = new System.Drawing.Size(20, 20); // this.simpleLabelItem1.SizeConstraintsType = SizeConstraintsType.Custom; // this.simpleLabelItem1.MaxSize = newSize; // this.simpleLabelItem1.MinSize = newSize; // this.simpleLabelItem1.Size = newSize; // this.simpleLabelItem1.AppearanceItemCaption.BackColor = System.Drawing.Color.Transparent; // this.simpleLabelItem1.ShowInCustomizationForm = false; // this.simpleLabelItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); // this.layoutControlGroupQuestion1.AddItem(this.simpleLabelItem1); //} else { // this.simpleLabelItem1 = null; //} // layoutControlItem1 this.lciOtherChoice = new LayoutControlItem(); //add textEdit1 to layout this.memoEdit1 = new MemoEdit(); this.memoEdit1.Tag = new ScheduleData() { ParentPositionIndex = "IndexPosition" + x.ToString(), PositionIndex = "IndexPosition" + idx.ToString(), ControlContainer = lciOtherChoice, Required = oChoice.Required, HasValue = !string.IsNullOrWhiteSpace(oChoice.DefaultInputValue) ? true : false, ChoiceOption = oChoice }; this.memoEdit1.Name = "textEdit" + Guid.NewGuid().ToString(); this.memoEdit1.Properties.ScrollBars = System.Windows.Forms.ScrollBars.None; this.memoEdit1.StyleController = this.StyleController; if (oChoice.DefaultInputValue != null) { this.memoEdit1.Text = oChoice.DefaultInputValue.Trim(); oChoice.InputValue = oChoice.DefaultInputValue.Trim(); } memoEdit1.TextChanged += new EventHandler(memoEdit1_TextChanged); memoEdit1.Resize += new EventHandler(memoEdit1_Resize); memoEdit1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.lciOtherChoice.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.lciOtherChoice.Control = this.memoEdit1; if (!string.IsNullOrEmpty(oChoice.TextPrefix)) { this.lciOtherChoice.Text = oChoice.TextPrefix; this.lciOtherChoice.TextVisible = true; this.lciOtherChoice.TextLocation = DevExpress.Utils.Locations.Top; this.lciOtherChoice.MaxSize = new Size(0, 41); this.lciOtherChoice.MinSize = new Size(0, 41); } else { this.lciOtherChoice.TextVisible = false; this.lciOtherChoice.MaxSize = new Size(0, 24); this.lciOtherChoice.MinSize = new Size(0, 24); } this.lciOtherChoice.SizeConstraintsType = SizeConstraintsType.Custom; this.lciOtherChoice.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.lciOtherChoice.ShowInCustomizationForm = false; this.layoutControlGroupQuestion1.AddItem(this.lciOtherChoice); idx++; } } #endregion } #region Footer //string prioText = oSettings.Priority; //if (oSettings.CustomerOwnership && oSettings.BVOwnership) { // prioText += "(Cust+BV)"; //} else if (oSettings.CustomerOwnership) { // prioText += "(Cust)"; //} else if (oSettings.BVOwnership) { // prioText += "(BV)"; //} //if (oSettings.PlotDoneStatus.Trim().ToLower() == "done") { // prioText += " Done"; //} //// simpleLabelItem1 status //this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); //this.emptySpaceItem1.Name = "simpleLabelItem" + Guid.NewGuid().ToString(); //this.emptySpaceItem1.AppearanceItemCaption.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); //this.emptySpaceItem1.AppearanceItemCaption.Options.UseTextOptions = true; //this.emptySpaceItem1.ShowInCustomizationForm = false; //this.emptySpaceItem1.SizeConstraintsType = SizeConstraintsType.Custom; //this.emptySpaceItem1.Text = prioText; //this.emptySpaceItem1.TextVisible = true; //this.emptySpaceItem1.ShowInCustomizationForm = false; //this.emptySpaceItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); //this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem1); //if (!string.IsNullOrEmpty(oSettings.QuestionHelp)) { // this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem(); // this.emptySpaceItem2.Name = "simpleLabelItem" + Guid.NewGuid().ToString(); // this.emptySpaceItem2.AppearanceItemCaption.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); // this.emptySpaceItem2.AppearanceItemCaption.Options.UseTextOptions = true; // this.emptySpaceItem2.ShowInCustomizationForm = false; // this.emptySpaceItem2.Text = "Help"; // this.emptySpaceItem2.OptionsToolTip.ToolTip = oSettings.QuestionHelp.Trim(); // //apply tooltip controller from parent // //if (this.ToolTipController != null && this.ToolTipController.DefaultController != null) { // // this.emptySpaceItem2.OptionsToolTip.ToolTipController = ToolTipController.DefaultController; // //} // this.emptySpaceItem2.TextVisible = true; // this.emptySpaceItem2.Size = new Size(50, 20); // this.emptySpaceItem2.MaxSize = new Size(50, 20); // this.emptySpaceItem2.MinSize = new Size(50, 20); // this.emptySpaceItem2.SizeConstraintsType = SizeConstraintsType.Custom; // this.emptySpaceItem2.ShowInCustomizationForm = false; // this.emptySpaceItem2.Click += new EventHandler(layoutControlGroupQuestion1_Click); // this.emptySpaceItem2.AppearanceItemCaption.TextOptions.HAlignment = HorzAlignment.Far; // this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem2, this.emptySpaceItem1, DevExpress.XtraLayout.Utils.InsertType.Right); //} #endregion this.layoutControlGroupQuestion1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.EndUpdate(); Image bg = BGImage(this); if (bg != null) { this.layoutControlGroupQuestion1.BackgroundImage = bg; this.layoutControlGroupQuestion1.BackgroundImageVisible = true; } if (this.memoEdit1 != null) BackColor = this.memoEdit1.BackColor; //lookUpEdit2.EditValue = null; //lookUpEdit2.ItemIndex = 0; this.ControlGroup = this.layoutControlGroupQuestion1; this.ControlGroup.Tag = this; isLoaded = true; }
/// <summary> /// Bind dynamic controls inside layout control /// </summary> public void BindControls() { #region Initialize if (Questionnaire == null) MessageBox.Show("Questionnaire must be bind with JSON first.", "Seminar Component"); var answerOpt = Questionnaire.Form.Settings.AnswerOptions[0] as ISeminar; if (SeminarScheduleDataSource == null) { if (answerOpt != null) { if (answerOpt.SeminarSchedule != null && answerOpt.SeminarSchedule.ScheduleValues.Count > 0) SeminarScheduleDataSource = answerOpt.SeminarSchedule.ScheduleValues; else { MessageBox.Show("\"SeminarScheduleDataSource\" property must be set first.", "Seminar Component"); return; } } else { MessageBox.Show("\"SeminarScheduleDataSource\" property must be set first.", "Seminar Component"); return; } } #endregion this.layoutControlGroupQuestion1.Clear(); Settings oSettings = Questionnaire.Form.Settings; // layoutControlGroupQuestion1 this.layoutControlGroupQuestion1.Name = "layoutControlGroupQuestion" + Guid.NewGuid().ToString(); this.layoutControlGroupQuestion1.AppearanceGroup.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); this.layoutControlGroupQuestion1.AppearanceGroup.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical; this.layoutControlGroupQuestion1.AppearanceGroup.Options.UseFont = true; this.layoutControlGroupQuestion1.ExpandButtonVisible = true; //this.layoutControlGroupQuestion1.Location = new System.Drawing.Point(0, 0); this.layoutControlGroupQuestion1.Padding = new DevExpress.XtraLayout.Utils.Padding(10, 10, 10, 10); this.layoutControlGroupQuestion1.ShowInCustomizationForm = false; this.layoutControlGroupQuestion1.Text = oSettings.Label + " " + oSettings.QuestionText; this.layoutControlGroupQuestion1.BeginUpdate(); IList<AnswerOption> answeroptionList = Questionnaire.Form.Settings.AnswerOptions; ISeminar answeroption = null; int iAnswerOptions = answeroptionList.Count; System.Drawing.Size newSize; int selectedIndex = 0; int idx = 0; for (int x = 0; x < iAnswerOptions; ++x) { answeroption = answeroptionList[x] as ISeminar; #region Seminar List // layoutControlItem1 this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); //lookUpEdit1 this.lookUpEdit1 = new LookUpEdit(); this.lookUpEdit1.Name = "lookUpEdit" + Guid.NewGuid().ToString(); this.lookUpEdit1.Properties.NullText = ""; this.lookUpEdit1.Properties.DisplayMember = "Name"; this.lookUpEdit1.Properties.ValueMember = "Id"; this.lookUpEdit1.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Name", "Seminars")); this.lookUpEdit1.Properties.ShowFooter = false; this.lookUpEdit1.Properties.ShowHeader = false; this.lookUpEdit1.ItemIndex = -1; this.lookUpEdit1.Tag = new SeminarData() { PositionIndex = "IndexPosition" + x, ControlContainer = layoutControlItem1 }; this.lookUpEdit1.Size = new System.Drawing.Size(155, 20); this.lookUpEdit1.StyleController = this.StyleController; this.lookUpEdit1.EditValueChanged += new EventHandler(lookUpEdit1_SelectedIndexChanged); this.lookUpEdit1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.lookUpEdit1.Properties.DataSource = SeminarScheduleDataSource; if (answeroption.SeminarSchedule != null && !string.IsNullOrEmpty(answeroption.SeminarSchedule.SelectedValue)) { this.lookUpEdit1.EditValue = answeroption.SeminarSchedule.SelectedValue; } else { selectedIndex = -1; } this.lookUpEdit1.ItemIndex = selectedIndex; // layoutControlItem1 this.layoutControlItem1.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.layoutControlItem1.Control = this.lookUpEdit1; int hgt = 28; if (answeroption.SeminarSchedule != null && !string.IsNullOrEmpty(answeroption.SeminarSchedule.TextPrefix)) { this.layoutControlItem1.Text = answeroption.SeminarSchedule.TextPrefix; hgt += 20; } else { this.layoutControlItem1.TextVisible = false; } this.layoutControlItem1.TextLocation = DevExpress.Utils.Locations.Top; this.layoutControlItem1.TextSize = new System.Drawing.Size(108, 13); this.layoutControlItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.layoutControlItem1.MaxSize = new System.Drawing.Size(0, hgt); this.layoutControlItem1.MinSize = new System.Drawing.Size(0, hgt); this.layoutControlItem1.Size = new System.Drawing.Size(50, 28); this.layoutControlItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem1); #endregion #region Customer Attendies //create our gridcontrol // // gridColumn1 // this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn1.Caption = "Attending"; this.gridColumn1.ColumnEdit = this.repositoryItemCheckEdit1; this.gridColumn1.FieldName = "Attending"; this.gridColumn1.Name = "gridColumn" + Guid.NewGuid().ToString(); this.gridColumn1.Visible = true; this.gridColumn1.VisibleIndex = 0; this.gridColumn1.Width = 57; // // repositoryItemCheckEdit1 // this.repositoryItemCheckEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit(); this.repositoryItemCheckEdit1.AutoHeight = false; this.repositoryItemCheckEdit1.Name = "repositoryItemCheckEdit" + Guid.NewGuid().ToString(); // // gridColumn2 // this.gridColumn2 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn2.Caption = "Name"; this.gridColumn2.FieldName = "Name"; this.gridColumn2.Name = "gridColumn" + Guid.NewGuid().ToString(); this.gridColumn2.Visible = true; this.gridColumn2.OptionsColumn.AllowEdit = false; this.gridColumn2.VisibleIndex = 1; this.gridColumn2.Width = 66; // // gridColumn3 // this.gridColumn3 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn3.Caption = "Address"; this.gridColumn3.FieldName = "Address"; this.gridColumn3.Name = "gridColumn" + Guid.NewGuid().ToString(); this.gridColumn3.Visible = true; this.gridColumn3.OptionsColumn.AllowEdit = false; this.gridColumn3.VisibleIndex = 2; this.gridColumn3.Width = 66; // // gridColumn4 // this.gridColumn4 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn4.Caption = "City"; this.gridColumn4.FieldName = "City"; this.gridColumn4.Name = "gridColumn" + Guid.NewGuid().ToString(); this.gridColumn4.Visible = true; this.gridColumn4.OptionsColumn.AllowEdit = false; this.gridColumn4.VisibleIndex = 3; this.gridColumn4.Width = 66; // // gridColumn5 // this.gridColumn5 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn5.Caption = "Telephone"; this.gridColumn5.FieldName = "Telephone"; this.gridColumn5.Name = "gridColumn" + Guid.NewGuid().ToString(); this.gridColumn5.Visible = true; this.gridColumn5.OptionsColumn.AllowEdit = false; this.gridColumn5.VisibleIndex = 4; this.gridColumn5.Width = 66; // // gridColumn6 // this.gridColumn6 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn6.Caption = "Email"; this.gridColumn6.FieldName = "Email"; this.gridColumn6.Name = "gridColumn" + Guid.NewGuid().ToString(); this.gridColumn6.Visible = true; this.gridColumn6.OptionsColumn.AllowEdit = false; this.gridColumn6.VisibleIndex = 5; this.gridColumn6.Width = 70; // // gridColumn7 // this.gridColumn7 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn7.Caption = "AccountID"; this.gridColumn7.FieldName = "AccountID"; this.gridColumn7.Name = "gridColumn" + Guid.NewGuid().ToString(); this.gridColumn7.Visible = false; // // gridColumn8 // this.gridColumn8 = new DevExpress.XtraGrid.Columns.GridColumn(); this.gridColumn8.Caption = "ContactID"; this.gridColumn8.FieldName = "ContactID"; this.gridColumn8.Name = "gridColumn" + Guid.NewGuid().ToString(); this.gridColumn8.Visible = false; // // gridView1 // this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView(); this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { this.gridColumn1, this.gridColumn2, this.gridColumn3, this.gridColumn4, this.gridColumn5, this.gridColumn6, this.gridColumn7, this.gridColumn8}); this.gridView1.GridControl = this.gridControl1; this.gridView1.Name = "gridView" + Guid.NewGuid().ToString(); this.gridView1.OptionsFind.AlwaysVisible = true; this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false; this.gridView1.OptionsView.ShowGroupPanel = false; this.gridView1.OptionsView.ColumnAutoWidth = false; this.gridView1.CellValueChanging += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(gridView1_CellValueChanging); // // gridControl1 // this.gridControl1 = new DevExpress.XtraGrid.GridControl(); this.gridControl1.LookAndFeel.UseDefaultLookAndFeel = false; this.gridControl1.MainView = this.gridView1; this.gridControl1.Name = "gridControl" + Guid.NewGuid().ToString(); this.gridControl1.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] { this.repositoryItemCheckEdit1}); this.gridControl1.Size = new System.Drawing.Size(412, 74); this.gridControl1.TabIndex = 11; this.gridControl1.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.gridView1}); BindAttendiesDatasource(); // // layoutControlItem2 // this.layoutControlItem2 = new LayoutControlItem(); this.layoutControlItem2.Control = this.gridControl1; this.layoutControlItem2.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.layoutControlItem2.Text = answeroption.AttendiesLabel; this.layoutControlItem2.TextLocation = DevExpress.Utils.Locations.Top; this.layoutControlItem2.TextSize = new System.Drawing.Size(108, 13); this.layoutControlItem2.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.layoutControlItem2.MaxSize = new System.Drawing.Size(0, 200); this.layoutControlItem2.MinSize = new System.Drawing.Size(0, 200); this.layoutControlItem2.Size = new System.Drawing.Size(200, 200); this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem2); // // simpleButton1 // this.simpleButton1 = new SimpleButton(); this.simpleButton1.Name = "simpleButton" + Guid.NewGuid().ToString(); this.simpleButton1.Size = new System.Drawing.Size(130, 22); this.simpleButton1.StyleController = this.StyleController; this.simpleButton1.Text = answeroption.AddContactButtonLabel; this.simpleButton1.Click += new EventHandler(simpleButton1_Click); // layoutControlItem2 this.layoutControlItem2 = new LayoutControlItem(); this.layoutControlItem2.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.layoutControlItem2.Control = this.simpleButton1; this.layoutControlItem2.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.layoutControlItem2.MaxSize = new System.Drawing.Size(150, 24); this.layoutControlItem2.MinSize = new System.Drawing.Size(80, 24); this.layoutControlItem2.Size = new System.Drawing.Size(80, 24); this.layoutControlItem2.TextVisible = false; this.layoutControlItem2.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem2); // // simpleButton1 // this.simpleButton1 = new SimpleButton(); this.simpleButton1.Name = "simpleButton" + Guid.NewGuid().ToString(); this.simpleButton1.Size = new System.Drawing.Size(130, 22); this.simpleButton1.StyleController = this.StyleController; this.simpleButton1.Text = "Refresh"; this.simpleButton1.Click += new EventHandler(simpleButton1Refresh_Click); // layoutControlItem1 this.layoutControlItem1 = new LayoutControlItem(); this.layoutControlItem1.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.layoutControlItem1.Control = this.simpleButton1; this.layoutControlItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.layoutControlItem1.MaxSize = new System.Drawing.Size(80, 24); this.layoutControlItem1.MinSize = new System.Drawing.Size(80, 24); this.layoutControlItem1.Size = new System.Drawing.Size(80, 24); this.layoutControlItem1.TextVisible = false; this.layoutControlItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem1, this.layoutControlItem2, DevExpress.XtraLayout.Utils.InsertType.Right); // emptySpaceItem1 this.emptySpaceItem1 = new EmptySpaceItem(); this.emptySpaceItem1.Name = "emptySpaceItem" + Guid.NewGuid().ToString(); this.emptySpaceItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; this.emptySpaceItem1.MaxSize = new System.Drawing.Size(0, 20); this.emptySpaceItem1.MinSize = new System.Drawing.Size(0, 20); this.emptySpaceItem1.Size = new System.Drawing.Size(200, 20); this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0); this.emptySpaceItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem1, this.layoutControlItem1, DevExpress.XtraLayout.Utils.InsertType.Right); #endregion #region Other Choices idx = 0; EmptySpaceItem esitem = new EmptySpaceItem(); esitem.Size = new Size(100, 20); this.layoutControlGroupQuestion1.AddItem(esitem); foreach (OtherChoice oChoice in answeroption.OtherChoices) { if (oChoice.Enabled) { if (!string.IsNullOrEmpty(oChoice.TextPrefix)) { // simpleLabelItem1 this.simpleLabelItem1 = new DevExpress.XtraLayout.SimpleLabelItem(); this.simpleLabelItem1.Name = "simpleLabelItem" + Guid.NewGuid().ToString(); //this.simpleLabelItem1.ShowInCustomizationForm = false; //this.simpleLabelItem1.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; this.simpleLabelItem1.Text = oChoice.TextPrefix; //newSize = new System.Drawing.Size(100, 20); newSize = new System.Drawing.Size(20, 20); this.simpleLabelItem1.SizeConstraintsType = SizeConstraintsType.Custom; this.simpleLabelItem1.MaxSize = new Size(0, 0); this.simpleLabelItem1.MinSize = newSize; this.simpleLabelItem1.Size = newSize; this.simpleLabelItem1.AppearanceItemCaption.BackColor = System.Drawing.Color.Transparent; this.simpleLabelItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.simpleLabelItem1); } else { this.simpleLabelItem1 = null; } // layoutControlItem1 this.layoutControlItem1 = new LayoutControlItem(); //add textEdit1 to layout this.memoEdit1 = new MemoEdit(); this.memoEdit1.Tag = new SeminarData() { ParentPositionIndex = "IndexPosition" + x.ToString(), PositionIndex = "IndexPosition" + idx.ToString(), ControlContainer = layoutControlItem1 }; this.memoEdit1.Name = "textEdit" + Guid.NewGuid().ToString(); this.memoEdit1.Properties.ScrollBars = System.Windows.Forms.ScrollBars.None; this.memoEdit1.StyleController = this.StyleController; memoEdit1.TextChanged += new EventHandler(memoEdit1_TextChanged); memoEdit1.Click += new EventHandler(layoutControlGroupQuestion1_Click); if (string.IsNullOrEmpty(oChoice.InputValue)) { if (!string.IsNullOrEmpty(oChoice.DefaultInputValue)) { this.memoEdit1.Text = oChoice.DefaultInputValue.Trim(); memoEdit1_TextChanged(this.memoEdit1, null); } } else { this.memoEdit1.Text = oChoice.InputValue.Trim(); memoEdit1_TextChanged(this.memoEdit1, null); } this.layoutControlItem1.Name = "layoutControlItem" + Guid.NewGuid().ToString(); this.layoutControlItem1.Control = this.memoEdit1; //int width = 0, height = 100; //if (!string.IsNullOrEmpty(oChoice.TextboxMaxWidth)) { // int.TryParse(oChoice.TextboxMaxWidth, out width); //} //if (!string.IsNullOrEmpty(oChoice.TextboxMaxHeight)) { // int.TryParse(oChoice.TextboxMaxHeight, out height); //} //newSize = new System.Drawing.Size(width, height); //this.layoutControlItem1.Size = new Size(200, 50); //this.layoutControlItem1.MaxSize = new Size(400, 50); //this.layoutControlItem1.MinSize = new Size(300, 50); this.layoutControlItem1.SizeConstraintsType = SizeConstraintsType.Custom; this.layoutControlItem1.MinSize = new Size(0, 60); //this.layoutControlItem1.Text = oChoice.TextPrefix; this.layoutControlItem1.TextVisible = false; this.layoutControlItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); //if (this.simpleLabelItem1 != null) { // this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem1,this.simpleLabelItem1, DevExpress.XtraLayout.Utils.InsertType.Right); //} else { this.layoutControlGroupQuestion1.AddItem(this.layoutControlItem1); //} idx++; } } #endregion } #region Footer string prioText = oSettings.Priority; if (oSettings.CustomerOwnership && oSettings.BVOwnership) { prioText += "(Cust+BV)"; } else if (oSettings.CustomerOwnership) { prioText += "(Cust)"; } else if (oSettings.BVOwnership) { prioText += "(BV)"; } if (oSettings.PlotDoneStatus.Trim().ToLower() == "done") { prioText += " Done"; } // simpleLabelItem1 status this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem(); this.emptySpaceItem1.Name = "simpleLabelItem" + Guid.NewGuid().ToString(); this.emptySpaceItem1.AppearanceItemCaption.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); this.emptySpaceItem1.AppearanceItemCaption.Options.UseTextOptions = true; this.emptySpaceItem1.ShowInCustomizationForm = false; this.emptySpaceItem1.SizeConstraintsType = SizeConstraintsType.Custom; this.emptySpaceItem1.Text = prioText; this.emptySpaceItem1.TextVisible = true; this.emptySpaceItem1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem1); if (!string.IsNullOrEmpty(oSettings.QuestionHelp)) { this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem(); this.emptySpaceItem2.Name = "simpleLabelItem" + Guid.NewGuid().ToString(); this.emptySpaceItem2.AppearanceItemCaption.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); this.emptySpaceItem2.AppearanceItemCaption.Options.UseTextOptions = true; this.emptySpaceItem2.ShowInCustomizationForm = false; this.emptySpaceItem2.Text = "Help"; this.emptySpaceItem2.OptionsToolTip.ToolTip = oSettings.QuestionHelp.Trim(); //apply tooltip controller from parent //if (this.ToolTipController != null && this.ToolTipController.DefaultController != null) { // this.emptySpaceItem2.OptionsToolTip.ToolTipController = ToolTipController.DefaultController; //} this.emptySpaceItem2.TextVisible = true; this.emptySpaceItem2.Size = new Size(50, 20); this.emptySpaceItem2.MaxSize = new Size(50, 20); this.emptySpaceItem2.MinSize = new Size(50, 20); this.emptySpaceItem2.SizeConstraintsType = SizeConstraintsType.Custom; this.emptySpaceItem2.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.emptySpaceItem2.AppearanceItemCaption.TextOptions.HAlignment = HorzAlignment.Far; this.layoutControlGroupQuestion1.AddItem(this.emptySpaceItem2, this.emptySpaceItem1, DevExpress.XtraLayout.Utils.InsertType.Right); } #endregion this.layoutControlGroupQuestion1.Click += new EventHandler(layoutControlGroupQuestion1_Click); this.layoutControlGroupQuestion1.EndUpdate(); Image bg = BGImage(this); if (bg != null) { this.layoutControlGroupQuestion1.BackgroundImage = bg; this.layoutControlGroupQuestion1.BackgroundImageVisible = true; } this.ControlGroup = this.layoutControlGroupQuestion1; this.ControlGroup.Tag = this; }