How to create a cursor in c# Graph application

Answered How to create a cursor in c# Graph application

  • 2011년 12월 14일 수요일 오후 2: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