コード例 #1
0
ファイル: ListViewItem.cs プロジェクト: KonajuGames/SharpLang
		public ListViewItem (string [] items, int imageIndex)
		{
			this.sub_items = new ListViewSubItemCollection (this, null);
			if (items != null) {
				for (int i = 0; i < items.Length; i++)
					sub_items.Add (new ListViewSubItem (this, items [i]));
			}
			this.image_index = imageIndex;
		}
コード例 #2
0
ファイル: ListViewItem.cs プロジェクト: KonajuGames/SharpLang
		protected virtual void Deserialize (SerializationInfo info, StreamingContext context)
		{
			sub_items = new ListViewSubItemCollection (this, null);
			int sub_items_count = 0;

			foreach (SerializationEntry entry in info) {
				switch (entry.Name) {
					case "Text":
						sub_items.Add ((string)entry.Value);
						break;
					case "Font":
						font = (Font)entry.Value;
						break;
					case "Checked":
						is_checked = (bool)entry.Value;
						break;
					case "ImageIndex":
						image_index = (int)entry.Value;
						break;
					case "StateImageIndex":
						state_image_index = (int)entry.Value;
						break;
					case "UseItemStyleForSubItems":
						use_item_style = (bool)entry.Value;
						break;
					case "SubItemCount":
						sub_items_count = (int)entry.Value;
						break;
					case "Group":
						group = (ListViewGroup)entry.Value;
						break;
					case "ImageKey":
						if (image_index == -1)
							image_key = (string)entry.Value;
						break;
				}
			}

			Type subitem_type = typeof (ListViewSubItem);
			if (sub_items_count > 0) {
				sub_items.Clear (); // .net fixup
				Text = info.GetString ("Text");
				for (int i = 0; i < sub_items_count - 1; i++)
					sub_items.Add ((ListViewSubItem)info.GetValue ("SubItem" + (i + 1), subitem_type));
			}

			// After any sub item has been added.
			ForeColor = (Color)info.GetValue ("ForeColor", typeof (Color));
			BackColor = (Color)info.GetValue ("BackColor", typeof (Color));
		}
コード例 #3
0
ファイル: ListViewItem.cs プロジェクト: KonajuGames/SharpLang
		public ListViewItem (ListViewItem.ListViewSubItem [] subItems, int imageIndex)
		{
			this.sub_items = new ListViewSubItemCollection (this, null);
			for (int i = 0; i < subItems.Length; i++)
				sub_items.Add (subItems [i]);
			this.image_index = imageIndex;
		}