cursor relocation

  • Thread starter Thread starter Anne
  • Start date Start date
A

Anne

Is there a way to determine the actual location of control when form is
displayed and programmatically move cursor on a button in a form?
I have a form, when use clicks some controls, a new form will be opened. I
want to move cursor right above on a button, but seems I can't make it work.
I used following lines of code, but seems cursor moves, but just not on that
button:
void doubleclickHandler()
{
Point* pt = __nogc new
System::Drawing::Point(AnotherForm->button->Location.X +
(AnotherForm->button->Width/2), AnotherForm->button->Location.Y +
AAnotherForm->button->Height/2));
Cursor::Position = *pt;
AnotherForm->ShowDialog();
}
I am using vc++. But result shows cursor did move, but not on that button as
desired. Am I doing something wrong here? I guess the problem is
Anotherform->button->Location changed after it shows up. Not exactly sure.

Anyone can help me?

Thanks,

-Anne
 
Anne said:
Is there a way to determine the actual location of control when form is
displayed and programmatically move cursor on a button in a form?
I have a form, when use clicks some controls, a new form will be opened. I
want to move cursor right above on a button, but seems I can't make it work.
I used following lines of code, but seems cursor moves, but just not on that
button:
void doubleclickHandler()
{
Point* pt = __nogc new
System::Drawing::Point(AnotherForm->button->Location.X +
(AnotherForm->button->Width/2), AnotherForm->button->Location.Y +
AAnotherForm->button->Height/2));
Cursor::Position = *pt;
AnotherForm->ShowDialog();
}
I am using vc++. But result shows cursor did move, but not on that button as
desired. Am I doing something wrong here? I guess the problem is
Anotherform->button->Location changed after it shows up. Not exactly sure.

Anyone can help me?

Can you use screen coordinate instead of the client coordinate?
 
Back
Top