By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,930 Members | 1,487 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,930 IT Pros & Developers. It's quick & easy.

Can't change cursor within a control

P: n/a
I'm trying to do this within a control I've created:
Cursor.Current = Cursors.WaitCursor;

During the initialization of the parent form, my control gets added to the
form, and while the control is being intialized, I call a method within the
control that sets the cursor to Cursors.WaitCursor, then processing
continues. I want the Cursor to remain that way until I set it back at any
given time, and if I don't set it back, I want to remain a WaitCursor.
I can't get this to work, I'm guessing it might have to do with the loading
of the form, resetting the cursor or something? How can I do this?
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I've even now overriden the paint method in my custom control and the paint
method in the extended listView class that is within my custom control.
Within that paint method, I try and override every cursor I can find.

The result of this, is the cursor is a default cursor when over the extended
listView object within the control, but it is an hour glass when it is
anywhere else on the control or form.

protected override void OnPaint(PaintEventArgs pea) {

if (this.ThreadRunning) {
//I'm trying to adjust all of the cursors just for testing.
this.Parent.Cursor=Cursors.WaitCursor;
this.Cursor=Cursors.WaitCursor;
Cursor=Cursors.WaitCursor;
}
}

One other note, I am kicking off a worker thread within my extend listView
object that is on my custom control. Any thoughts?

"Craig" wrote:
I'm trying to do this within a control I've created:
Cursor.Current = Cursors.WaitCursor;

During the initialization of the parent form, my control gets added to the
form, and while the control is being intialized, I call a method within the
control that sets the cursor to Cursors.WaitCursor, then processing
continues. I want the Cursor to remain that way until I set it back at any
given time, and if I don't set it back, I want to remain a WaitCursor.
I can't get this to work, I'm guessing it might have to do with the loading
of the form, resetting the cursor or something? How can I do this?

Nov 16 '05 #2

P: n/a
Appearantly this is a bug related to the cursor and listview, see quote from
a post by Peter Huang:

"Because this is a problem in the current winform control in .net FW
1.1(vs.net 2003), while in the next release Whidbey(.net FW 2.0), the
winform control will also be updated. So the problem is not the VS.NET IDE
but the underlying Framework which provides the listview
control.(system.windows.forms.dll)"

"Craig" wrote:
I've even now overriden the paint method in my custom control and the paint
method in the extended listView class that is within my custom control.
Within that paint method, I try and override every cursor I can find.

The result of this, is the cursor is a default cursor when over the extended
listView object within the control, but it is an hour glass when it is
anywhere else on the control or form.

protected override void OnPaint(PaintEventArgs pea) {

if (this.ThreadRunning) {
//I'm trying to adjust all of the cursors just for testing.
this.Parent.Cursor=Cursors.WaitCursor;
this.Cursor=Cursors.WaitCursor;
Cursor=Cursors.WaitCursor;
}
}

One other note, I am kicking off a worker thread within my extend listView
object that is on my custom control. Any thoughts?

"Craig" wrote:
I'm trying to do this within a control I've created:
Cursor.Current = Cursors.WaitCursor;

During the initialization of the parent form, my control gets added to the
form, and while the control is being intialized, I call a method within the
control that sets the cursor to Cursors.WaitCursor, then processing
continues. I want the Cursor to remain that way until I set it back at any
given time, and if I don't set it back, I want to remain a WaitCursor.
I can't get this to work, I'm guessing it might have to do with the loading
of the form, resetting the cursor or something? How can I do this?

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.