public int Add(IndexedListItem item) { Guid GUID = Guid.NewGuid(); item.ItemLabel.Name = "index_" + GUID.ToString(); item.ItemLabel.BorderStyle = BorderStyle.None; item.ItemLabel.BackColor = this.parent.IndexBackColor; item.ItemLabel.Click += new EventHandler(parent.OnItemLabelClick); item.ItemRichTextBox.CaseSensitive = true; item.ItemRichTextBox.Name = "text_" + GUID.ToString(); item.ItemRichTextBox.BorderStyle = BorderStyle.None; item.ItemRichTextBox.BackColor = this.parent.TextBackColor; item.ItemRichTextBox.GotFocus += new EventHandler(parent.OnItemRichTextBoxClick); item.ItemRichTextBox.Separators = this.parent.Separators; item.ItemRichTextBox.HighlightDescriptors = this.parent.HighlightDescriptors; item.SelectedChange += new SelectedChangeEventHandler(item_SelectedChange); item.MouseOverToken += new MouseOverTokenEventHandler(parent.OnMouseOverToken); item.ItemTextChanged += new ItemTextChangedEventHandler(parent.OnItemTextChanged); item.ItemClick += new ItemClickEventHandler(parent.OnItemClick); item.ItemTextEnter += new ItemTextEnterEventHandler(parent.OnItemTextEnter); item.ItemTextSelectionChanged += new ItemTextSelectionChangedEventHandler(parent.OnItemTextSelectionChanged); parent.Controls.Add(item.ItemLabel); parent.Controls.Add(item.ItemRichTextBox); int result = items.Add(item); parent.PerformLayout(); return(result); }
public void Insert(int index, IndexedListItem item) { Guid GUID = Guid.NewGuid(); item.ItemLabel.Name = "index_" + GUID.ToString(); item.ItemLabel.BorderStyle = BorderStyle.None; item.ItemLabel.BackColor = parent.IndexBackColor; item.ItemLabel.Click += new EventHandler(parent.OnItemLabelClick); item.ItemRichTextBox.CaseSensitive = true; item.ItemRichTextBox.Name = "text_" + GUID.ToString(); item.ItemRichTextBox.BorderStyle = BorderStyle.None; item.ItemRichTextBox.BackColor = parent.TextBackColor; item.ItemRichTextBox.GotFocus += new EventHandler(parent.OnItemRichTextBoxClick); item.ItemRichTextBox.Separators = this.parent.Separators; item.ItemRichTextBox.HighlightDescriptors = this.parent.HighlightDescriptors; item.SelectedChange += new SelectedChangeEventHandler(item_SelectedChange); item.MouseOverToken += new MouseOverTokenEventHandler(parent.OnMouseOverToken); item.ItemTextChanged += new ItemTextChangedEventHandler(parent.OnItemTextChanged); parent.Controls.Add(item.ItemLabel); parent.Controls.Add(item.ItemRichTextBox); parent.Controls.SetChildIndex(item.ItemLabel, index * 2); parent.Controls.SetChildIndex(item.ItemRichTextBox, (index * 2) + 1); items.Insert(index, item); parent.PerformLayout(); }
public void Remove(IndexedListItem item) { items.Remove(item); parent.Controls.Remove(item.ItemLabel); parent.Controls.Remove(item.ItemRichTextBox); parent.SelectedIndex = -1; parent.PerformLayout(); }
protected override void OnParentChanged(EventArgs e) { base.OnParentChanged(e); if (this.DesignMode) { IndexedListItem ili = new IndexedListItem(); ili.Index = "Index"; ili.Text = "Text"; ili.ReadOnly = true; this.items.Add(ili); } }
public void DataBind() { IEnumerable data = ResolveDataSource(); if (data == null) { return; } if (this.IndexDataField == null || this.TextDataField == null || this.UniqueIDDataField == null) { return; } Win32.SendMessage(this.Handle, Win32.WM_SETREDRAW, 0, (IntPtr)0); this.SuspendLayout(); this.items.Clear(); IEnumerator ie = data.GetEnumerator(); while (ie.MoveNext()) { IndexedListItem ili = new IndexedListItem(); PropertyInfo indexDataField = ie.Current.GetType().GetProperty(this.IndexDataField); ili.Index = (string)indexDataField.GetValue(ie.Current, null); PropertyInfo textDataField = ie.Current.GetType().GetProperty(this.TextDataField); ili.Text = (string)textDataField.GetValue(ie.Current, null); PropertyInfo tagDataField = ie.Current.GetType().GetProperty(this.UniqueIDDataField); ili.Tag = (string)tagDataField.GetValue(ie.Current, null); this.items.Add(ili); } foreach (IndexedListItem ili in this.items) { ili.ItemRichTextBox.ParseNow(); } this.ResumeLayout(true); Win32.SendMessage(this.Handle, Win32.WM_SETREDRAW, 1, (IntPtr)0); this.Refresh(); }
protected override void OnParentChanged(EventArgs e) { base.OnParentChanged(e); if(this.DesignMode) { IndexedListItem ili = new IndexedListItem(); ili.Index = "Index"; ili.Text = "Text"; ili.ReadOnly = true; this.items.Add(ili); } }
public void DataBind() { IEnumerable data = ResolveDataSource(); if(data == null) { return; } if(this.IndexDataField == null || this.TextDataField == null || this.UniqueIDDataField == null) { return; } Win32.SendMessage(this.Handle,Win32.WM_SETREDRAW,0,(IntPtr)0); this.SuspendLayout(); this.items.Clear(); IEnumerator ie = data.GetEnumerator(); while(ie.MoveNext()) { IndexedListItem ili = new IndexedListItem(); PropertyInfo indexDataField = ie.Current.GetType().GetProperty(this.IndexDataField); ili.Index = (string)indexDataField.GetValue(ie.Current,null); PropertyInfo textDataField = ie.Current.GetType().GetProperty(this.TextDataField); ili.Text = (string)textDataField.GetValue(ie.Current,null); PropertyInfo tagDataField = ie.Current.GetType().GetProperty(this.UniqueIDDataField); ili.Tag = (string)tagDataField.GetValue(ie.Current,null); this.items.Add(ili); } foreach(IndexedListItem ili in this.items) { ili.ItemRichTextBox.ParseNow(); } this.ResumeLayout(true); Win32.SendMessage(this.Handle,Win32.WM_SETREDRAW,1,(IntPtr)0); this.Refresh(); }
public int IndexOf(IndexedListItem item) { return(items.IndexOf(item)); }
public bool Contains(IndexedListItem item) { return(items.Contains(item)); }
public void Insert(int index, IndexedListItem item) { Guid GUID = Guid.NewGuid(); item.ItemLabel.Name = "index_" + GUID.ToString(); item.ItemLabel.BorderStyle = BorderStyle.None; item.ItemLabel.BackColor = parent.IndexBackColor; item.ItemLabel.Click += new EventHandler(parent.OnItemLabelClick); item.ItemRichTextBox.CaseSensitive = true; item.ItemRichTextBox.Name = "text_" + GUID.ToString(); item.ItemRichTextBox.BorderStyle = BorderStyle.None; item.ItemRichTextBox.BackColor = parent.TextBackColor; item.ItemRichTextBox.GotFocus += new EventHandler(parent.OnItemRichTextBoxClick); item.ItemRichTextBox.Separators = this.parent.Separators; item.ItemRichTextBox.HighlightDescriptors = this.parent.HighlightDescriptors; item.SelectedChange += new SelectedChangeEventHandler(item_SelectedChange); item.MouseOverToken += new MouseOverTokenEventHandler(parent.OnMouseOverToken); item.ItemTextChanged += new ItemTextChangedEventHandler(parent.OnItemTextChanged); parent.Controls.Add(item.ItemLabel); parent.Controls.Add(item.ItemRichTextBox); parent.Controls.SetChildIndex(item.ItemLabel,index * 2); parent.Controls.SetChildIndex(item.ItemRichTextBox,(index * 2) + 1); items.Insert(index, item); parent.PerformLayout(); }
public int IndexOf(IndexedListItem item) { return items.IndexOf(item); }
public bool Contains(IndexedListItem item) { return items.Contains(item); }
public int Add(IndexedListItem item) { Guid GUID = Guid.NewGuid(); item.ItemLabel.Name = "index_" + GUID.ToString(); item.ItemLabel.BorderStyle = BorderStyle.None; item.ItemLabel.BackColor = this.parent.IndexBackColor; item.ItemLabel.Click += new EventHandler(parent.OnItemLabelClick); item.ItemRichTextBox.CaseSensitive = true; item.ItemRichTextBox.Name = "text_" + GUID.ToString(); item.ItemRichTextBox.BorderStyle = BorderStyle.None; item.ItemRichTextBox.BackColor = this.parent.TextBackColor; item.ItemRichTextBox.GotFocus += new EventHandler(parent.OnItemRichTextBoxClick); item.ItemRichTextBox.Separators = this.parent.Separators; item.ItemRichTextBox.HighlightDescriptors = this.parent.HighlightDescriptors; item.SelectedChange += new SelectedChangeEventHandler(item_SelectedChange); item.MouseOverToken += new MouseOverTokenEventHandler(parent.OnMouseOverToken); item.ItemTextChanged += new ItemTextChangedEventHandler(parent.OnItemTextChanged); item.ItemClick += new ItemClickEventHandler(parent.OnItemClick); item.ItemTextEnter += new ItemTextEnterEventHandler(parent.OnItemTextEnter); item.ItemTextSelectionChanged += new ItemTextSelectionChangedEventHandler(parent.OnItemTextSelectionChanged); parent.Controls.Add(item.ItemLabel); parent.Controls.Add(item.ItemRichTextBox); int result = items.Add(item); parent.PerformLayout(); return result; }