Changing Cursor in custom ControlDesigner

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Joe said:
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
 

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