Hi Martin,
I tested your code snippet in a WinForm MC++ project, the following line:
Cursor::Current = Cursors::Default;
seems never been called, it appears the cursor had already been
trapped/beloned by the picture box(m_PicBox) just after you click the left
button of the mouse first time, you cannot trap it in the original function
again.
So I modify the code as following:
...
System::Void Form1_MouseUp(System::Object* sender,
System::Windows::Forms::MouseEventArgs* mea)
{
if(mea->Button == MouseButtons::Left){
Cursor::Current->Clip =
Rectangle(m_PicBox->PointToScreen(Point(m_PicBox->ClientRectangle.Left,
m_PicBox->ClientRectangle.Top)), m_PicBox->Size);
}
}
System::Void m_PicBox_MouseUp(System::Object* sender,
System::Windows::Forms::MouseEventArgs* mea)
{
if(mea->Button == MouseButtons::Left){
this->Cursor = new
System::Windows::Forms::Cursor(Cursor::Current->Handle);
Cursor::Clip = Rectangle(this->Location, this->Size);
}
}
...
Wish it helps!
Best regards,
Gary Chang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
mphanke - 12 Jun 2004 12:08 GMT
Hi Gary,
thanks for your help! I haven't had time to implement this at the
moment, but I will tomorrow.. I will give you feedback then. Do you have
any idea why this behaviour is?
Martin
mphanke - 12 Jun 2004 13:04 GMT
Hi Gary,
okay, I figured it out! The problem was I was changing the cursor on the
MouseDown event - this does not work...
Thanks alot for your support!
Martin
Snippet for whoever is interested:
void OnMouseUp(Object * sender, MouseEventArgs * mea)
{
if(mea->Button == MouseButtons::Left)
{
m_bLeft = !m_bLeft;
if(m_bLeft)
{
m_rectClip = Rectangle(Cursor::Current->Clip);
Cursor::Current->Clip =
Rectangle(m_PicBox->PointToScreen(Point(m_PicBox->ClientRectangle.Left,
m_PicBox->ClientRectangle.Top)), m_PicBox->Size);
}
else
{
m_ParentForm->Cursor = new
System::Windows::Forms::Cursor(Cursor::Current->Handle);
Cursor::Clip = Rectangle(m_rectClip);
}
}
}
"Gary Chang" - 15 Jun 2004 04:16 GMT
Hi Martin,
Thanks for your response and I am glad to know you got the solution!
Good Luck!
Best regards,
Gary Chang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------