How to create a cursor in c# Graph application
-
2011年12月14日 14:03
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
全部回复
-
2011年12月15日 7:57版主
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
- 已编辑 Helen ZhouModerator 2011年12月15日 7:58
- 已标记为答案 Helen ZhouModerator 2011年12月29日 3:52

