當前位置: 首頁>>代碼示例>>C#>>正文


C# SerializationInfo.ToString方法代碼示例

本文整理匯總了C#中System.Runtime.Serialization.SerializationInfo.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# SerializationInfo.ToString方法的具體用法?C# SerializationInfo.ToString怎麽用?C# SerializationInfo.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Runtime.Serialization.SerializationInfo的用法示例。


在下文中一共展示了SerializationInfo.ToString方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: MainWindow

		public MainWindow() {
			int		X;
			int		Y;
			CursorInfo	ci;

			ClientSize = new System.Drawing.Size (max_labels_row * size_of_label, (((num_of_cursors + (max_labels_row - (num_of_cursors % max_labels_row))) * size_of_label) / (max_labels_row * size_of_label)) * size_of_label);
			Text = "SWF Cursor Test App";

			labels = new Label[num_of_cursors];

			ci = new CursorInfo();
			for (int i = 0; i < num_of_cursors; i++) {
				GetCursor(i, out ci);

				labels[i] = new Label();
				labels[i].Location = new Point((i * size_of_label) % (max_labels_row * size_of_label), ((i * size_of_label) / (max_labels_row * size_of_label)) * size_of_label);
				labels[i].Size = new Size(size_of_label, size_of_label);
				labels[i].Text = ci.name;
				labels[i].BackColor = Color.FromArgb(i * 9, i * 9, i * 9);
				labels[i].ForeColor = Color.Red;
				labels[i].Cursor = ci.cursor;
				labels[i].Paint += new PaintEventHandler(MainWindow_Paint);
				this.Controls.Add(labels[i]);

			}

			// Get the GetDataObject method
			SerializationInfo	si;
			FormatterConverter	fc;

			fc = new FormatterConverter();
			si = new SerializationInfo(typeof(Cursor), fc);
			((ISerializable)ci.cursor).GetObjectData(si, new StreamingContext(StreamingContextStates.All));

			Console.WriteLine("Member count: {0}", si.MemberCount);

			Console.WriteLine("Members: {0}", si.MemberCount);
			SerializationInfoEnumerator e;
			e = si.GetEnumerator();
			while (e.MoveNext()) {
				Console.WriteLine("Member {0}", e.Name);
			}

			byte [] data = (byte [])si.GetValue ("CursorData", typeof (byte []));
			Console.WriteLine("CursorData:");
			for (int i = 0; i < data.Length; i++) {
				Console.Write("{0:X2}, ", data[i]);
			}
			Console.WriteLine("");

			Console.WriteLine("Result: {0}", si.ToString());
				
			//ci.cursor.I

			KeyDown += new KeyEventHandler(MainWindow_KeyDown);
		}		
開發者ID:hitswa,項目名稱:winforms,代碼行數:56,代碼來源:swf-cursor.cs


注:本文中的System.Runtime.Serialization.SerializationInfo.ToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。