Esempio n. 1
0
		private void GetCursor(int index, out CursorInfo ci) {
			switch(index) {
				case 0: {
					ci.name = "AppStarting";
					ci.cursor = Cursors.AppStarting;
					return;
				}

				case 1: {
					ci.name = "Arrow";
					ci.cursor = Cursors.Arrow;
					return;
				}

				case 2: {
					ci.name = "Cross";
					ci.cursor = Cursors.Cross;
					return;
				}

				case 3: {
					ci.name = "Default";
					ci.cursor = Cursors.Default;
					return;
				}

				case 4: {
					ci.name = "Hand";
					ci.cursor = Cursors.Hand;
					return;
				}

				case 5: {
					ci.name = "Help";
					ci.cursor = Cursors.Help;
					return;
				}

				case 6: {
					ci.name = "HSplit";
					ci.cursor = Cursors.HSplit;
					return;
				}

				case 7: {
					ci.name = "IBeam";
					ci.cursor = Cursors.IBeam;
					return;
				}

				case 8: {
					ci.name = "No";
					ci.cursor = Cursors.No;
					return;
				}

				case 9: {
					ci.name = "NoMove2D";
					ci.cursor = Cursors.NoMove2D;
					return;
				}

				case 10: {
					ci.name = "NoMoveHoriz";
					ci.cursor = Cursors.NoMoveHoriz;
					return;
				}

				case 11: {
					ci.name = "NoMoveVert";
					ci.cursor = Cursors.NoMoveVert;
					return;
				}

				case 12: {
					ci.name = "PanEast";
					ci.cursor = Cursors.PanEast;
					return;
				}

				case 13: {
					ci.name = "PanNorth";
					ci.cursor = Cursors.PanNorth;
					return;
				}

				case 14: {
					ci.name = "PanNE";
					ci.cursor = Cursors.PanNE;
					return;
				}

				case 15: {
					ci.name = "PanNW";
					ci.cursor = Cursors.PanNW;
					return;
				}

				case 16: {
					ci.name = "PanSE";
					ci.cursor = Cursors.PanSE;
					return;
				}

				case 17: {
					ci.name = "PanSouth";
					ci.cursor = Cursors.PanSouth;
					return;
				}

				case 18: {
					ci.name = "PanSW";
					ci.cursor = Cursors.PanSW;
					return;
				}

				case 19: {
					ci.name = "PanWest";
					ci.cursor = Cursors.PanWest;
					return;
				}

				case 20: {
					ci.name = "SizeAll";
					ci.cursor = Cursors.SizeAll;
					return;
				}

				case 21: {
					ci.name = "SizeNESW";
					ci.cursor = Cursors.SizeNESW;
					return;
				}

				case 22: {
					ci.name = "SizeNS";
					ci.cursor = Cursors.SizeNS;
					return;
				}

				case 23: {
					ci.name = "SizeNWSE";
					ci.cursor = Cursors.SizeNWSE;
					return;
				}

				case 24: {
					ci.name = "SizeWE";
					ci.cursor = Cursors.SizeWE;
					return;
				}

				case 25: {
					ci.name = "UpArrow";
					ci.cursor = Cursors.UpArrow;
					return;
				}

				case 26: {
					ci.name = "VSplit";
					ci.cursor = Cursors.VSplit;
					return;
				}

				case 27: {
					ci.name = "WaitCursor";
					ci.cursor = Cursors.WaitCursor;
					return;
				}

				case 28: {
					ci.name = "Application defined";
					ci.cursor = new Cursor("mycursor.cur");
					return;
				}

				default: {
					ci.name = "Default";
					ci.cursor = Cursors.Default;
					return;
				}
			}
		}
Esempio n. 2
0
		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);
		}