Live Chat Icon For mobile
Live Chat Icon

How to convert a Cursor class to a .cur file

Platform: WinForms| Category: Cursors
	protected void WriteCursorToFile(Cursor cursor, string fileName)
	{
		byte[] blob = TypeDescriptor.GetConverter(typeof(System.Windows.Forms.Cursor)).ConvertTo(cursor, typeof(byte[])) as byte[];

		if(blob != null)
		{
			FileStream fileStream = new FileStream(fileName, FileMode.Create);
			fileStream.Write(blob, 0, blob.Length);
			fileStream.Flush();
			fileStream.Close();
		}
		else
			MessageBox.Show('Unable to convert Cursor to byte[]');
	}

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.