Use The Cursor Property

  • Thread starter Thread starter shachar
  • Start date Start date
S

shachar

hi all.
in vb6 i wroted screen.mousepointer=0 and it changes the
cursor type of the screen, regardless of the control it
was over.
how can i do it in vb.net?
 
Shachar,

The cursor is a property of every control.

The only thing I have to offer you is this snippet, however that set all the
cursors to default.

\\\
Private Sub Button1_Click(ByVal sender _
As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click
doSet(Me)
End Sub
Private Sub doSet(ByVal parentCtr As Control)
Dim ctr As Control
For Each ctr In parentCtr.Controls
ctr.Cursor = Cursors.Default
doSet(ctr)
Next
End Sub
///

I hope this helps?

Cor
 
shachar said:
in vb6 i wroted screen.mousepointer=0 and it changes the
cursor type of the screen, regardless of the control it
was over.

\\\
Cursor.Current = ...
///
 
That does not work as the OP would like as far as I can see

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
 
If you set the Me.Cursor property to your desired cursor, this will remain
in force over all controls in the form unless you change it.

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
 
Terry,

I was curious to this behaviour, when that setting is not done, it acts as
you wrote, however with setting it first it does not.

However maybe there is something wrong in my little test

Cor

\\\
Private Sub Form2_Load(ByVal sender _
As Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
Button1.Cursor = Cursors.Help
Button2.Cursor = Cursors.No
End Sub

Private Sub Button1_Click(ByVal sender _
As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click
Me.Cursor = Cursors.Hand
End Sub

Private Sub Button2_Click(ByVal sender _
As System.Object, ByVal e As System.EventArgs) _
Handles Button2.Click
Button2.Cursor = Cursors.Cross
Me.Cursor = Cursors.Default
End Sub

///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top