public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { _editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService; if (_editorService == null) { return(base.EditValue(context, provider, value)); } var report = GetReport(context); if (report == null) { return(base.EditValue(context, provider, value)); } var listBox = new ListBoxEx { BorderStyle = BorderStyle.None, PaintIndicatorSupported = true, ItemHeight = 20 }; listBox.Click += listBox_Click; listBox.PaintIndicator += listBox_PaintIndicator; listBox.Items.Add(EditorText); _dbFields = new List <FieldInfo>(); _dbFields.AddRange(report.DataSource.DataSourceInfo.ImageFields); foreach (var dbField in report.DataSource.DataSourceInfo.TextFields) { if (dbField.DataType == typeof(string)) { _dbFields.Add(dbField); } } listBox.Items.AddRange(_dbFields.Select(f => (object)f.Name).ToArray()); var itemsToDisplay = Math.Min(MaxDisplayListBoxItems, listBox.Items.Count); listBox.Height = itemsToDisplay * listBox.ItemHeight; if (value != null) { listBox.SelectedItem = value.ToString(); } _editorService.DropDownControl(listBox); if (listBox.SelectedIndex == 0) { value = base.EditValue(context, provider, value); } else if (listBox.SelectedIndex > 0) { var fieldName = listBox.SelectedItem.ToString(); value = PictureHolder.FromExpression(fieldName); } _dbFields = null; return(value); }
private void Add路线属性() { ListBoxEx con = new ListBoxEx { Width = 80, Height = 100, ItemHeight = 16 }; ListBoxItem item = new ListBoxItem("行驶时间", "0") { Tag = 1 }; ListBoxItem item2 = new ListBoxItem("限速", "1") { Tag = 2 }; ListBoxItem item3 = new ListBoxItem("南纬", "2") { Tag = 4 }; ListBoxItem item4 = new ListBoxItem("西经", "3") { Tag = 8 }; con.DrawMode = DrawMode.OwnerDrawFixed; con.FormattingEnabled = true; con.IsCheckBox = true; con.SelectionMode = SelectionMode.MultiSimple; con.Items.AddRange(new object[] { item, item2, item3, item4 }); this._路线属性 = new AutoDropDown(con); base.Controls.Add(this._路线属性); this._路线属性.VisibilityChange += new VisibleChanged(this._路线属性_VisibilityChange); }
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()); }
public void regenerateRoomList() { ListBoxEx list = Manager.MainWindow.lbRooms; list.Items.Clear(); foreach (GmsRoom elem in GmsResourceRoomList) { list.Items.Add(elem.name); } }
private void _路线属性_VisibilityChange(bool isvisible) { ListBoxEx innerControl = this._路线属性.InnerControl as ListBoxEx; if (!isvisible) { ListBox.SelectedObjectCollection selectedItems = innerControl.SelectedItems; string str = ""; int count = innerControl.Items.Count; int num2 = 0; for (int i = 0; i < count; i++) { if (selectedItems.Contains(innerControl.Items[i])) { ListBoxItem item = innerControl.Items[i] as ListBoxItem; num2 |= Convert.ToInt32(item.Tag.ToString()); str = str + item.Name.ToString() + ","; } } string str2 = Convert.ToString(num2, 2).PadLeft(4, '0'); this.dgvPathSegment.CurrentRow.Cells["SegmentFlagValue"].Value = num2; this.setTimeSpeedReadOnly(this.dgvPathSegment.CurrentRow, num2); this.seghi[this.dgvPathSegment.CurrentRow.Cells["PathID"].Value.ToString() + "," + this.dgvPathSegment.CurrentRow.Cells["PathSegmentID"].Value.ToString()] = Convert.ToInt32(str2, 2); if (this.dgvPathSegment.CurrentCell != null) { try { this.dgvPathSegment.CurrentCell.Value = str.Trim(new char[] { ',' }); this.dgvPathSegment.CurrentCell.Tag = str2; } catch (Exception) { } } } else { innerControl.ClearSelected(); if (this.dgvPathSegment.CurrentCell.Value.ToString().Length > 0) { List <string> list = new List <string>(); string[] collection = this.dgvPathSegment.CurrentCell.Value.ToString().Split(new char[] { ',' }); list.AddRange(collection); int num4 = innerControl.Items.Count; for (int j = 0; j < num4; j++) { ListBoxItem item2 = innerControl.Items[j] as ListBoxItem; if (list.Contains(item2.Name)) { innerControl.SetSelected(j, true); } } } } }
private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ComboBoxEx)); this.listBox = new CtrlControls.ExListBox.ListBoxEx(); this.BaseText = new CtrlControls.ExTextBox.TextBoxEx(); this.SuspendLayout(); // // listBox // this.listBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.listBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.listBox.Font = new System.Drawing.Font("宋体", 11F); this.listBox.FormattingEnabled = true; this.listBox.ItemHeight = 35; this.listBox.Location = new System.Drawing.Point(0, 20); this.listBox.Name = "listBox"; this.listBox.Size = new System.Drawing.Size(200, 4); this.listBox.TabIndex = 3; // // BaseText // this.BaseText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.BaseText.Border = false; this.BaseText.BorderNormalColor = System.Drawing.Color.RoyalBlue; this.BaseText.BorderNormalImage = ((System.Drawing.Image)(resources.GetObject("BaseText.BorderNormalImage"))); this.BaseText.BorderOverColor = System.Drawing.Color.BlueViolet; this.BaseText.BorderOverImage = ((System.Drawing.Image)(resources.GetObject("BaseText.BorderOverImage"))); this.BaseText.BorderStyle = System.Windows.Forms.BorderStyle.None; this.BaseText.BorderWeight = 1F; this.BaseText.Font = new System.Drawing.Font("宋体", 11F); this.BaseText.Location = new System.Drawing.Point(0, 1); this.BaseText.Name = "BaseText"; this.BaseText.Size = new System.Drawing.Size(169, 17); this.BaseText.TabIndex = 2; this.BaseText.WaterColor = System.Drawing.Color.DarkGray; this.BaseText.WaterText = ""; // // ComboBoxEx // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.listBox); this.Controls.Add(this.BaseText); this.Name = "ComboBoxEx"; this.Size = new System.Drawing.Size(200, 19); this.ResumeLayout(false); this.PerformLayout(); }
public void regenerateInstanceList() { if (Room == null) { return; } ListBoxEx list = Manager.MainWindow.lbInstances; list.Items.Clear(); foreach (GmsRoomInstance instance in Room.instances) { list.Items.Add(instance.objName + ": " + instance.name); } }
private ListBox createListBox() { ListBoxEx listBox = new ListBoxEx(); listBox.BorderStyle = BorderStyle.None; listBox.FormattingEnabled = true; listBox.Click += new System.EventHandler(listBox_Click); listBox.Font = this.Font; listBox.Format += new System.Windows.Forms.ListControlConvertEventHandler(listBox_Format); listBox.KeyDown += new System.Windows.Forms.KeyEventHandler(listBox_KeyDown); listBox.PreviewKeyDown += listBox_PreviewKeyDown; listBox.LostFocus += listBox_LostFocus; listBox.NCMouseButtonDown += listBox_NCMouseButtonDown; return(listBox); }
//protected void _renderItemList(List<string> list, GMItem _node) //{ // if (_node == null) return; // foreach (GMItem _object in _node.getSubitems()) // { // if (_object.isGroup) // { // _renderItemList(list, _object); // } // else // { // list.Add(_object.Name); // } // } //} //private bool _treeAddGMItemGroup(TreeNode t, List<GMItem> items) //{ // bool anyChecked = false; // foreach (GMItem item in items) // { // TreeNode newT = t.Nodes.Add(item.Name, item.Name); // if (item.isGroup) // { // bool anySubChecked = false; // newT.ImageIndex = 0; // newT.SelectedImageIndex = 1; // anySubChecked = _treeAddGMItemGroup(newT, item.getSubitems()); // // Tree node doesn't support indeterminade :( // //if (anySubChecked) // //{ // // newT.Check // //} // anyChecked |= anySubChecked; // } // else // { // newT.ImageIndex = 3; // switch (item.ResourceType) // { // case GMItemType.Background: // case GMItemType.Sprite: newT.ImageIndex = 6; break; // case GMItemType.Script: newT.ImageIndex = 5; break; // } // newT.SelectedImageIndex = newT.ImageIndex; // if (item.used == GMItemUsage.used) // { // if (t.TreeView.CheckBoxes) // { // newT.Checked = true; // anyChecked = true; // } // newT.StateImageIndex = 7; // } // } // } // return anyChecked; //} /*public void resetUsedRes() * { * RegisteredResources = new List<string>(); * }*/ /*public void addUsedRes(string name) * { * if (RegisteredResources == null) * { * resetUsedRes(); * } * * * //string spritePath = ProjectSource + "\\sprites\\images\\" + name + "_0.png"; * //if (File.Exists(spritePath)) * //{ * // GraphicsManager.LoadTexture(new Bitmap(spritePath), RegisteredResources.Count); * //} * RegisteredResources.Add(name); * }*/ /*public void checkForRegisteredRes() * { * _checkForRegisteredRes(allItems.getSubitems()); * } * * private void _checkForRegisteredRes(List<GMItem> items) * { * foreach (GMItem item in items) * { * if (item.isGroup) * { * _checkForRegisteredRes(item.getSubitems()); * } * else * { * if (RegisteredResources.IndexOf(item.Name) > -1) * { * item.used = GMItemUsage.used; * } * else { item.used = (item.used == GMItemUsage.used) ? GMItemUsage.disposed : GMItemUsage.unused; } * } * } * }*/ #region ENVinstances //public void addEnvDef(string name) //{ // PlaceableElement n = new PlaceableElement() { Name = name }; // PlaceableList.Add(n); //} public void regenerateEnvDefList() { ListBoxEx list = Manager.MainWindow.lbPlaceables; list.Items.Clear(); //foreach (PlaceableElement elem in PlaceableList) //{ // list.Items.Add(elem.Name); //} foreach (GmsObject elem in GmsResourceObjectList) { list.Items.Add(elem.name); } Manager.MainWindow.statusLabelPlaceables.Text = GmsResourceObjectList.Count.ToString(); }
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); }
public void regenerateLayerList() { if (Room == null) { return; } //RoomLayers = new ObservableCollection<MapLayers>(RoomLayers.OrderByDescending(x => x.LayerDepth)); ToolStripComboBox tb = Manager.MainWindow.tbLayerDropDown; ListBoxEx lb = Manager.MainWindow.lbLayers; ToolStripDropDownButton td = Manager.MainWindow.tbEnabledLayersDropdown; tb.Items.Clear(); lb.Items.Clear(); td.DropDownItems.Clear(); foreach (MapLayers layer in Room.Layers) { tb.Items.Add(layer.LayerName + " (" + layer.LayerDepth.ToString() + ")"); lb.Items.Add(layer.LayerName); ToolStripMenuItem item = new ToolStripMenuItem() { Text = layer.LayerName, Checked = true, CheckOnClick = true //, //OwnerItem = tb }; item.Click += new EventHandler(Manager.MainWindow.tbEnabledLayersDropdown_SubItemClick); td.DropDownItems.Add(item); } if (tb.Items.Count > 0) { tb.SelectedIndex = 0; } }
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 MoveFocusToColumn7(object sender, RoutedEventArgs e) => ListBoxEx.SetMoveFocusToColumnIndex(list, 6);
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")); } } } }
private void listBoxFiles_SelectedIndexChanged(object sender, System.EventArgs e) { //Cursor.Current = Cursors.WaitCursor; // Now, we'll only show the wait cursor if we have to interrogate the file // Dynamically display info about Poll ListBoxEx listBox = sender as ListBoxEx; if (listBox.SelectedIndex < listBox.Items.Count) // We need to check because for some reason, non-existent indices are sometimes returned! { string filename = FullPathInfo[listBox.SelectedIndex].ToString(); string summary = ""; int respondentCount = 0; int questionCount = 0; int revision = 0; bool reviewData = true; // Retrieve pertinent info about this poll GetPollDetails(filename, out revision, out summary, out reviewData, out questionCount, out respondentCount); // If no questions or no respondents then change icon image. We'll still allow user // to hit "Next" but then inform them why they can't proceed. if (questionCount == 0) { listBox.Items[listBox.SelectedIndex].ImageIndex = 0; textBoxSummary.Text = summary; menuItemNext.Enabled = true; } else if (respondentCount == 0) { listBox.Items[listBox.SelectedIndex].ImageIndex = 1; textBoxSummary.Text = summary; menuItemNext.Enabled = true; } // If we're reviewing data and ReviewData isn't allowed then display red circle with line through it. Also disable Next. else if (OpenMode == SelectFileMode.ReviewData && !reviewData) { listBox.Items[listBox.SelectedIndex].ImageIndex = 4; textBoxSummary.Text = "Sorry, but the review of this poll's data has been disabled."; menuItemNext.Enabled = false; } else { textBoxSummary.Text = summary; menuItemNext.Enabled = true; } textBoxRespondents.Text = " " + respondentCount.ToString(); textBoxQuestions.Text = " " + questionCount.ToString(); // Nothing but LeftAlign allowed so the space will compensate some textBoxRevision.Text = " " + revision.ToString(); } else { listBox.SelectedIndex = -1; textBoxSummary.Text = ""; textBoxQuestions.Text = ""; textBoxRespondents.Text = ""; textBoxRevision.Text = ""; menuItemNext.Enabled = false; } Cursor.Current = Cursors.Default; }