private void GeneralDomainValue(int val, out string showtext) { string str = ""; ListBoxEx innerControl = this._路线属性.InnerControl as ListBoxEx; int count = innerControl.Items.Count; string str2 = this.ToErJin(val).ToString(); ArrayList list = new ArrayList(); for (int i = 0; i < 6; i++) { if (str2.Length > i) { list.Add(str2.Substring((str2.Length - i) - 1, 1)); } else { list.Add("0"); } } for (int j = 0; j < count; j++) { if (list[j].ToString().Equals("1")) { Client.ListBoxItem item = innerControl.Items[j] as Client.ListBoxItem; str = str + item.Name.ToString() + ","; } } showtext = str.Trim(",".ToCharArray()); }
private void Add路线属性() { ListBoxEx con = new ListBoxEx(); Client.ListBoxItem item = new Client.ListBoxItem("根据时间", "0"); Client.ListBoxItem item2 = new Client.ListBoxItem("限速", "1"); Client.ListBoxItem item3 = new Client.ListBoxItem("进区域报警给驾驶员", "2"); Client.ListBoxItem item4 = new Client.ListBoxItem("进区域报警给平台", "3"); Client.ListBoxItem item5 = new Client.ListBoxItem("出区域报警给驾驶员", "4"); Client.ListBoxItem item6 = new Client.ListBoxItem("出区域报警给平台", "5"); con.DrawMode = DrawMode.OwnerDrawFixed; con.FormattingEnabled = true; con.IsCheckBox = true; con.SelectionMode = SelectionMode.MultiSimple; con.Items.AddRange(new object[] { item, item2, item3, item4, item5, item6 }); this._路线属性 = new AutoDropDown(con); base.Controls.Add(this._路线属性); this._路线属性.VisibilityChange += new VisibleChanged(this._路线属性_VisibilityChange); }
private ArrayList GeneralDomainText(string text) { ListBoxEx innerControl = this._路线属性.InnerControl as ListBoxEx; string str = ""; int count = innerControl.Items.Count; ArrayList list = new ArrayList(count); for (int i = 0; i < count; i++) { string str2 = ""; if (text.Contains(innerControl.Items[i].ToString())) { str2 = "1"; Client.ListBoxItem item = innerControl.Items[i] as Client.ListBoxItem; str = str + item.Name.ToString() + ","; } else { str2 = "0"; } list.Add(str2); } return(list); }
private void _路线属性_VisibilityChange(bool isvisible) { ListBoxEx innerControl = this._路线属性.InnerControl as ListBoxEx; if (!isvisible) { string str = ""; new List <string>(); ListBox.SelectedObjectCollection selectedItems = innerControl.SelectedItems; int count = innerControl.Items.Count; ArrayList list = new ArrayList(count); for (int i = 0; i < count; i++) { string str2 = ""; if (selectedItems.Contains(innerControl.Items[i])) { str2 = "1"; Client.ListBoxItem item = innerControl.Items[i] as Client.ListBoxItem; str = str + item.Name.ToString() + ","; } else { str2 = "0"; } list.Add(str2); } if (this.dgvPath.CurrentCell != null) { try { this.dgvPath.CurrentCell.Value = str.Trim(",".ToCharArray()); this.dgvPath.CurrentCell.Tag = list; } catch (Exception) { } } } else { innerControl.ClearSelected(); if (this.dgvPath.CurrentCell.Tag == null) { if (this.dgvPath.CurrentCell.Value != null) { List <string> list2 = new List <string>(); list2.AddRange(this.dgvPath.CurrentCell.Value.ToString().Split(",".ToCharArray())); int num3 = innerControl.Items.Count; for (int j = 0; j < num3; j++) { Client.ListBoxItem item2 = innerControl.Items[j] as Client.ListBoxItem; if (list2.Contains(item2.Name)) { innerControl.SetSelected(j, true); } } } } else if (this.dgvPath.CurrentCell.Tag != null) { ArrayList tag = this.dgvPath.CurrentCell.Tag as ArrayList; for (int k = 0; k < innerControl.Items.Count; k++) { innerControl.SetSelected(k, tag[k].ToString().Equals("1")); } } } }