protected override void OnElementChanged(ElementChangedEventArgs <View> e) { element = (XCheckBox)Element; var checkBoxControl = new BemCheckBox.BemCheckBox(new CGRect(0, 0, width, height), new MyBemCheckBoxDelegate((checkedValue) => { element.RaiseChecked(checkedValue); })); SetNativeControl(checkBoxControl); if (Control == null) { return; } if (Element.WidthRequest != -1) { width = Element.WidthRequest; } if (Element.HeightRequest != -1) { height = Element.HeightRequest; } ChangeCheckBoxColors(); base.OnElementChanged(e); }
private void ReNameContols(string ControlType) { bool IsReNameAll = GlobalMethods.Misc.IsEmptyString(ControlType); IControl control = null; if (ControlType == "XCheckBox" || IsReNameAll) { control = new XCheckBox(); this.RefreshContols(control, "XCheckBox"); } if (ControlType == "XDateTime" || IsReNameAll) { control = new XDateTime(); this.RefreshContols(control, "XDateTime"); } if (ControlType == "XRadioButton" || IsReNameAll) { control = new XRadioButton(); this.RefreshContols(control, "XRadioButton"); } if (ControlType == "XTextBox" || IsReNameAll) { control = new XTextBox(); this.RefreshContols(control, "XTextBox"); } if (ControlType == "XComboBox" || IsReNameAll) { control = new XComboBox(); this.RefreshContols(control, "XComboBox"); } }
/// <summary> /// 2016-11-23,mxj,add /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnselectp_Click(object sender, EventArgs e) { try { string jcr = ""; foreach (Control c in this.pnlItems.Controls) { if (c is XCheckBox) { XCheckBox checkBox = c as XCheckBox; if (checkBox.Checked) { jcr += c.Text + ","; } } } if (jcr.Length > 0) { jcr = jcr.Substring(0, jcr.Length - 1); txt_jcry.Text = jcr; } } catch (Exception ex) { } }
void checkBox_CheckedChanged(object sender, EventArgs e) { if (!m_IsFormLoad) { //在不是窗体加载的情况下 this.m_DetailLists.Clear(); foreach (Control c in this.pnlItems.Controls) { if (c is XCheckBox) { XCheckBox checkBox = c as XCheckBox; if (checkBox.Checked) { XVStaffCItemInfo staffItemInfo = new XVStaffCItemInfo(); staffItemInfo.RID = Guid.NewGuid().ToString(); staffItemInfo.UserId = this.m_PrimaryKeyId; staffItemInfo.InputUserId = XCommon.LoginUsersInfo.RID; staffItemInfo.NameCN = checkBox.Text; XCodeCItemInfo itemInfo = checkBox.Model as XCodeCItemInfo; staffItemInfo.CItemId = itemInfo.RID; this.m_DetailLists.Add(staffItemInfo); } } } } }
protected override void OnFillData() { this.scrollBarPanel.RemoveRenderAll(); if (ciDiagItemList != null && ciDiagItemList.Count > 0) { this.scrollBarPanel.AddRender(this.ciXCheckBox); //ciDiagItemList 中索引值 int itmeIndex = 0; // 动态创建XCheckBox的行、列数 int rowCnt = this.getRowCnt(ciDiagItemList.Count); int columnCnt = this.getColumnCnt(); // 动态创建XCheckBox的起始坐标 int startX = this.ciXCheckBox.Location.X + this.ciXCheckBox.Size.Width + HORIZONTAL_SPACE; int startY = this.ciXCheckBox.Location.Y; // 动态创建XCheckBox控件的坐标 int tempX = 0; int tempY = 0; // 按行构建XCheckBox控件 for (int i = 0; i < rowCnt; i++) { tempY = i * (BOX_SIZE.Height + VERTICAL_SPACE) + startY; for (int j = 0; j < columnCnt; j++) { tempX = j * (BOX_SIZE.Width + HORIZONTAL_SPACE) + startX; if (itmeIndex == ciDiagItemList.Count) { break; } CiDiagItemDO ciDiagItem = ciDiagItemList[itmeIndex]; itmeIndex++; XCheckBox xCheckBox = new XCheckBox(); xCheckBox.Size = BOX_SIZE; //xCheckBox.Alignment = StringAlignment.Near; xCheckBox.Text = ciDiagItem.Id_didef_name; xCheckBox.ValueObj = ciDiagItem; // 设置显示tooltip否则不能文字超出XCheckBox宽度的文字会正常显示,而不是以tooltip方式显示 xCheckBox.IsShowToolTip = true; xCheckBox.Location = new Point(tempX, tempY); xCheckBox.Name = CIDI_ITEM; this.scrollBarPanel.AddRender(xCheckBox); } } } this.scrollBarPanel.getScrollBarRect(); this.scrollBarPanel.Refresh(); this.Refresh(); }
/// <summary> /// 临床诊断复选框选中状态变化事件 /// <para>相当于全选、取消全选按钮功能</para> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ciXCheckBox_ValueTextChanged(object sender, System.EventArgs e) { List <IXRender> renderList = this.scrollBarPanel.Renders; foreach (IXRender render in renderList) { if (render is XCheckBox) { if (sender != render) { XCheckBox checkBox = (XCheckBox)render; checkBox.ValueText = ((XCheckBox)sender).ValueText; } } } }
protected override void OnElementChanged(ElementChangedEventArgs <View> e) { var control = new Android.Widget.CheckBox(Context); SetNativeControl(control); if (Element == null) { return; } element = (XCheckBox)Element; element.ChildRemoved += ChildRemoved; control.CheckedChange += CheckedChanged; ChangeCheckBoxColor(); base.OnElementChanged(e); }
void OrderOutView_ValueTextChanged(object sender, EventArgs e) { if (!Created) { return; } if (sender == null) { return; } XCheckBox chk = (XCheckBox)sender; (this.xapFormControl1.GetUserRender("ordout", "des_again31") as XLabelBaseUserRender).Enabled = chk.Checked; if (chk.Checked != true) { (this.xapFormControl1.GetUserRender("ordout", "des_again31") as XLabelBaseUserRender).ValueText = ""; } }
/// <summary> /// 获取选中的诊断,并通过事件发送给接收对象 /// </summary> private List <CiDiagItemDO> GendSelectItemList() { List <CiDiagItemDO> cidiItemList = new List <CiDiagItemDO>(); List <IXRender> renderList = this.scrollBarPanel.Renders; foreach (IXRender render in renderList) { if (render is XCheckBox) { XCheckBox cidiCheckBox = (XCheckBox)render; if (CIDI_ITEM.Equals(cidiCheckBox.Name) && cidiCheckBox.Checked) { cidiItemList.Add((CiDiagItemDO)cidiCheckBox.ValueObj); } } } return(cidiItemList); }
private void checkAllRender_ValueTextChanged(object sender, EventArgs e) { XCheckBox checkBox = sender as XCheckBox; if (checkBox.Checked) { foreach (OrderRender orrender in this.OrderRenderList) { orrender.Check = true; } } else { foreach (OrderRender orrender in this.OrderRenderList) { orrender.Check = false; } } this.Invalidate(); }
/// <summary> /// 初始化人员CheckBox /// </summary> protected virtual void InitItemCheckBoxes() { string sqlget = "select RID, UserName from StaffInfo "; DataTable dt = new DataTable(); dt = SQLHelper.GetDataSet(sqlget); int xStart = 10; //x开始距离 int yStart = 10; //y开始距离 int xDistance = 60; //横向距离 int yDistance = 6; //纵向距离 int perRowCount = 10; //每行的数量 int loopNo = 0; foreach (DataRow dr in dt.Rows) { XCheckBox checkBox = new XCheckBox(); checkBox.Text = dr[1].ToString(); //checkBox.Model = itemInfo; //checkBox.CheckedChanged += new EventHandler(checkBox_CheckedChanged); int x = xStart + (loopNo % perRowCount) * xDistance; int y = yStart + (loopNo / perRowCount) * yDistance; checkBox.Location = new Point(x, y); checkBox.AutoSize = true; this.pnlItems.Controls.Add(checkBox); //if (this.IsHaveItem(itemInfo)) //{ // checkBox.Checked = true; //} loopNo += 1; } this.pnlItems.BringToFront(); }
/// <summary> /// 模板render /// </summary> /// <param name="parent">父容器</param> /// <param name="isRadio">是否是单选</param> public OrderRender(Control parent, bool isRadio = false) { this.parent = parent; this.isRadio = isRadio; this.EditFlag = true; this.disableImage = Bitmap.FromStream(Assembly.GetCallingAssembly().GetManifestResourceStream("iih.ci.ord.res.image.ci.报错.png")); if (this.isRadio) { this.radio = new XRadiobox(); this.radio.Size = new Size(17, 24); this.radio.ValueTextChanged += new EventHandler(render_ValueTextChanged); this.AddRender(radio); } else { this.check = new XCheckBox(); this.check.Size = new Size(17, 24); this.check.ValueTextChanged += new EventHandler(render_ValueTextChanged); this.AddRender(check); } this.Check = false; }
/// <summary> /// 初始化审批的文件CheckBox /// </summary> protected virtual void InitItemCheckBoxes() { IList <XModelBase> documents = this.m_ItemBusiness.GetAll(); int xStart = 30; //x开始距离 int yStart = 10; //y开始距离 int xDistance = 240; //横向距离 int yDistance = 30; //纵向距离 int perRowCount = 3; //每行的数量 int loopNo = 0; foreach (XModelBase model in documents) { XCodeCItemInfo itemInfo = model as XCodeCItemInfo; XCheckBox checkBox = new XCheckBox(); checkBox.Text = itemInfo.NameCN; checkBox.Model = itemInfo; checkBox.CheckedChanged += new EventHandler(checkBox_CheckedChanged); int x = xStart + (loopNo % perRowCount) * xDistance; int y = yStart + (loopNo / perRowCount) * yDistance; checkBox.Location = new Point(x, y); checkBox.AutoSize = true; this.pnlItems.Controls.Add(checkBox); if (this.IsHaveItem(itemInfo)) { checkBox.Checked = true; } loopNo += 1; } this.pnlItems.BringToFront(); }
public CheckBox CreateCheckBox(XCheckBox checkBox, Window root, int row) { string text = checkBox.Text ?? ""; if (Binder.IsBindable(text)) { text = _binder.GetBindedText(text); } var result = new CheckBox(text) { X = Pos.Left(root) + checkBox.Left, Y = Pos.Top(root) + row, }; if (Binder.IsBindable(checkBox.IsChecked)) { result.Checked = _binder.GetBindedBool(checkBox.IsChecked); _binder.Register(checkBox, result); } return(result); }
private void RenderCheckBox(XCheckBox checkBox) { string text = checkBox.Text ?? ""; if (Binder.IsBindable(text)) { text = _binder.GetBindedText(text); } var result = new CheckBox(text) { X = Pos.Left(this) + checkBox.Left, Y = Pos.Top(this) + _rowCounter, }; if (Binder.IsBindable(checkBox.IsChecked)) { result.Checked = _binder.GetBindedBool(checkBox.IsChecked); _binder.Register(checkBox, result, typeof(bool)); } SetWidth(result, checkBox); Add(result); }
/// <summary> /// 初始化添加窗体 /// </summary> protected virtual void InitAddForm() { foreach (Control contorl in this.pnlEdit.Controls) { contorl.Enabled = true; if (contorl is XEditBox) { if (contorl.Name != "txtParentNode") { contorl.Text = string.Empty; } } else if (contorl is XCheckBox) { XCheckBox checkBox = contorl as XCheckBox; checkBox.Checked = false; } else if (contorl is XNumberEditBox) { XNumberEditBox numberEditBox = contorl as XNumberEditBox; numberEditBox.Value = 0; } } }
private void ResetControl(bool isHerb, NewOrderTemplateDTO tnmpDto) { if (isHerb) { if (topControl != null && this.RenderControls.Contains(topControl)) { return; } topControl = new XBaseControl(); topControl.Size = new Size(this.Size.Width, 36); topControl.Location = new Point(1, 0); this.AddRender(topControl); usageRender = XLabelControlFactory.GetLabelComboBox(topControl, tnmpDto.getrouteList()); usageRender.ValueText = tnmpDto.Name_route; usageRender.Size = new System.Drawing.Size(236, 24); usageRender.TitleText = "用法:"; usageRender.Location = new Point(0, 6); usageRender.ValueTextChanged += new EventHandler(usageRender_ValueTextChanged); topControl.AddRender(usageRender); frequencyRender = XLabelControlFactory.GetLabelComboBox(topControl, tnmpDto.getFreqdefdo()); frequencyRender.TitleText = "频次:"; frequencyRender.ValueText = tnmpDto.Name_freq; frequencyRender.Size = new System.Drawing.Size(236, 24); frequencyRender.Location = new Point(usageRender.Bound.Right, 6); frequencyRender.ValueTextChanged += new EventHandler(frequencyRender_ValueTextChanged); topControl.AddRender(frequencyRender); decoctionRender = XLabelControlFactory.GetLabelComboBox(topControl, tnmpDto.getBoilList()); decoctionRender.TitleText = "煎法:"; decoctionRender.ValueText = tnmpDto.Name_boil; decoctionRender.Size = new System.Drawing.Size(236, 24); decoctionRender.Location = new Point(frequencyRender.Bound.Right, 6); decoctionRender.ValueTextChanged += new EventHandler(decoctionRender_ValueTextChanged); topControl.AddRender(decoctionRender); checkAllRender = new XCheckBox(); checkAllRender.Text = "全选"; checkAllRender.Location = new Point(decoctionRender.Bound.Right + 20, (36 - checkAllRender.Bound.Height) / 2); checkAllRender.ValueTextChanged += new EventHandler(checkAllRender_ValueTextChanged); topControl.AddRender(checkAllRender); this.ContainerControl.Size = new Size(this.Size.Width, this.Size.Height - 37); this.ContainerControl.Location = new Point(1, 37); this.Container.Size = new Size(this.Container.Width, this.ContainerControl.Height); if (this.Container.Width <= this.ContainerControl.Width) { this.Container.Size = new Size(this.ContainerControl.Width, this.ContainerControl.Height); } else { this.Container.Size = new Size(this.Container.Width, this.ContainerControl.Height); } } else { if (topControl != null && this.RenderControls.Contains(topControl)) { this.RemoveRender(topControl); this.ContainerControl.Size = new Size(this.Size.Width, this.Size.Height); this.ContainerControl.Location = new Point(1, 0); this.Container.Size = new Size(this.Container.Width, this.ContainerControl.Height); if (this.Container.Width <= this.ContainerControl.Width) { this.Container.Size = new Size(this.ContainerControl.Width, this.ContainerControl.Height); } else { this.Container.Size = new Size(this.Container.Width, this.ContainerControl.Height); } } } }
/// <summary> /// 获取查询控件的查询条件 /// </summary> /// <param name="queryControl"></param> /// <returns></returns> public string GetControlWhereCondition() { XCheckBox isQueryCheckBox = m_QueryControl.QueryCheckBox; if (isQueryCheckBox != null && isQueryCheckBox.Checked == false && isQueryCheckBox.Visible == true) { //如果是否查询复选框不为null,并且没有选择复选框,并且复选框不可见,则查询全部 return(string.Empty); } string firstValue = this.GetFirstValue(); string secondValue = this.GetSecondValue(); string where = string.Empty; switch (m_QueryControl.QueryOperateType) { case XQueryOperateType.Equal: return(where += this.GetEqualCondition(firstValue)); case XQueryOperateType.IsEmpty: where = string.Empty; return(where += this.GetEmptyCondition()); case XQueryOperateType.LessThan: return(where += this.GetLessThanCondition(firstValue)); case XQueryOperateType.LessThanOrEqual: return(where += this.GetLessThanOrEqualCondition(firstValue)); case XQueryOperateType.MoreThan: return(where += this.GetMoreThanCondition(firstValue)); case XQueryOperateType.MoreThanOrEqual: return(where += this.GetMoreThanOrEqualCondition(firstValue)); case XQueryOperateType.NotEqual: return(where += this.GetNotEqualCondition(firstValue)); case XQueryOperateType.NotIsEmpty: return(where += this.GetNotEmptyCondition()); case XQueryOperateType.Contain: if (m_QueryControl.GetType().Name == "XSelectCustomerEditBox") { return(where += this.GetEqualCondition(firstValue)); } else { return(where += this.GetContainCondition(firstValue)); } case XQueryOperateType.EndWith: return(where += this.GetEndWithCondtion(firstValue)); case XQueryOperateType.StartWith: return(where += this.GetStartWithCondition(firstValue)); case XQueryOperateType.ContainText: return(where += this.GetContainCondition(secondValue)); default: return(string.Empty); } }