コード例 #1
0
        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);
        }
コード例 #2
0
        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();
        }
コード例 #3
0
 public void Remove(IndexedListItem item)
 {
     items.Remove(item);
     parent.Controls.Remove(item.ItemLabel);
     parent.Controls.Remove(item.ItemRichTextBox);
     parent.SelectedIndex = -1;
     parent.PerformLayout();
 }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        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();
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
        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();
        }
コード例 #8
0
 public int IndexOf(IndexedListItem item)
 {
     return(items.IndexOf(item));
 }
コード例 #9
0
 public bool Contains(IndexedListItem item)
 {
     return(items.Contains(item));
 }
コード例 #10
0
		public void Remove(IndexedListItem item)
		{
			items.Remove(item);
			parent.Controls.Remove(item.ItemLabel);
			parent.Controls.Remove(item.ItemRichTextBox);
			parent.SelectedIndex = -1;
			parent.PerformLayout();
		}
コード例 #11
0
		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();
		}
コード例 #12
0
		public int IndexOf(IndexedListItem item)
		{
			return items.IndexOf(item);
		}
コード例 #13
0
		public bool Contains(IndexedListItem item)
		{
			return items.Contains(item);
		}
コード例 #14
0
		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;
		}