/// <summary> /// 添加初始化字段 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdAddFld_Click(object sender, EventArgs e) { _conditionCount++; var newCondition = new CtlAddBsonEl(); _conditionPos.Y += newCondition.Height; newCondition.Location = _conditionPos; newCondition.Name = "BsonEl" + _conditionCount; panBsonEl.Controls.Add(newCondition); }
/// <summary> /// 加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmGroup_Load(object sender, EventArgs e) { var mongoCol = RuntimeMongoDbContext.GetCurrentCollection(); var mongoColumn = MongoHelper.GetCollectionSchame(mongoCol); var conditionPos = new Point(50, 20); foreach (var item in mongoColumn) { //动态加载控件 var ctrItem = new CheckBox {Name = item, Location = conditionPos, Text = item}; panColumn.Controls.Add(ctrItem); //纵向位置的累加 conditionPos.Y += ctrItem.Height; } conditionPos = new Point(50, 20); var firstAddBsonElCtl = new CtlAddBsonEl {Location = conditionPos, Name = "BsonEl" + _conditionCount}; var el = new BsonElement("count", new BsonInt32(0)); firstAddBsonElCtl.SetElement(el); panBsonEl.Controls.Add(firstAddBsonElCtl); if (GuiConfig.IsUseDefaultLanguage) return; ctlReduce.Title = GuiConfig.GetText(TextType.GroupTabReduce); ctlFinalize.Title = GuiConfig.GetText(TextType.GroupTabFinalize); lblSelectGroupField.Text = GuiConfig.GetText(TextType.GroupTabGroupNotes); lblAddInitField.Text = GuiConfig.GetText(TextType.GroupTabInitColumnNote); cmdAddInitField.Text = GuiConfig.GetText(TextType.GroupTabInitColumn); lblResult.Text = GuiConfig.GetText(TextType.GroupTabResult); cmdQuery.Text = GuiConfig.GetText(TextType.GroupLoadQuery); cmdRun.Text = GuiConfig.GetText(TextType.CommonOk); }