How to create a cursor in c# Graph application
-
Wednesday, December 14, 2011 2:03 PM
Hai friends,
I am creating a graph application c# . I want to create a cursor which is a line of length 100 .
Please help me ... Your suggestions are welcomed
Thanks and regards
Leenu Thomas
Leenu Thomas
All Replies
-
Thursday, December 15, 2011 7:57 AMModerator
Hello Leenu,
The following code example draws the specified cursor on the form in its normal size, and in stretched mode, twice its size. This example requires that you have a Form and a Cursor object to pass into the method when it is called.
private void DrawCursorsOnForm(Cursor cursor) { // If the form's cursor is not the Hand cursor and the // Current cursor is the Default, Draw the specified // cursor on the form in normal size and twice normal size. if(this.Cursor != Cursors.Hand & Cursor.Current == Cursors.Default) { // Draw the cursor stretched. Graphics graphics = this.CreateGraphics(); Rectangle rectangle = new Rectangle(new Point(10,10), new Size(cursor.Size.Width * 2, cursor.Size.Height * 2)); cursor.DrawStretched(graphics, rectangle); // Draw the cursor in normal size. rectangle.Location = new Point( rectangle.Width + rectangle.Location.X, rectangle.Height + rectangle.Location.Y); rectangle.Size = cursor.Size; cursor.Draw(graphics, rectangle); // Dispose of the cursor. cursor.Dispose(); } }For more information please check the MSDN document: Cursor.Draw Method
Regards,
Helen Zhou [MSFT]
MSDN Community Support | Feedback to us
- Edited by Helen ZhouModerator Thursday, December 15, 2011 7:58 AM
- Marked As Answer by Helen ZhouModerator Thursday, December 29, 2011 3:52 AM


