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

Changing Cursor in custom ControlDesigner

P: n/a
Joe
I'm working on a usercontrol, and an associated ControlDesigner for it.
In the designer, when I mouse over a particular area of the usercontrol, I
want to change the cursor from the standard SizeAll, to SizeWE.

In the class for my derived ControlDesigner, i have the following code:

protected override void OnSetCursor()
{
try
{
if (this._InSplitter)
{
this.Control.Cursor = Cursors.SizeWE;
}
else
{
base.OnSetCursor();
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}

Everything else, in both my control and designer, function normally.
However, when I mouse over the designated area and the above code is
triggered, the IDE crashes. Actually, i wouldn't call it crashing, it just
disappears w/o warning. The whole IDE instance is gone. Any one have any
clues? The offending line is

this.Control.Cursor = Cursors.SizeWE;

I have tried using the same line of code elsewhere in my designer class, and
while it doesn't crash, it doesn't work either.

I've tried this on my laptop using C# 2005 Express, and my desktop using the
full VS pro 2005, with the same results.

Any help greatly appreciated,

Joe
Jul 14 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Joe
"Joe" wrote:
I'm working on a usercontrol, and an associated ControlDesigner for it.
In the designer, when I mouse over a particular area of the usercontrol, I
want to change the cursor from the standard SizeAll, to SizeWE.

In the class for my derived ControlDesigner, i have the following code:

protected override void OnSetCursor()
{
try
{
if (this._InSplitter)
{
this.Control.Cursor = Cursors.SizeWE;
}
else
{
base.OnSetCursor();
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}

Everything else, in both my control and designer, function normally.
However, when I mouse over the designated area and the above code is
triggered, the IDE crashes. Actually, i wouldn't call it crashing, it just
disappears w/o warning. The whole IDE instance is gone. Any one have any
clues? The offending line is

this.Control.Cursor = Cursors.SizeWE;

I have tried using the same line of code elsewhere in my designer class, and
while it doesn't crash, it doesn't work either.

I've tried this on my laptop using C# 2005 Express, and my desktop using the
full VS pro 2005, with the same results.

Any help greatly appreciated,

Joe
I tried following the directions here
http://msdn2.microsoft.com/en-us/library/5ytx0z24.aspx
to debug my designer code at design time.

When stepping through the code,
this.Control.Cursor = Cursors.SizeWE;
works fine, but as soon as I hit F5 to run through it, it crashes the
debugger instance of VS. Any clues?

Joe
Jul 15 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.