当前位置: 首页>>代码示例>>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;未经允许,请勿转载。