Hi:
I'm having trouble when I try to change my rad form location. I wrote a code to calculate the new form position by limit the x an y position to the screen boundaries. If the user try to put the form out of the boundaries, the code reasign the location to make my form fully visible. Here's my code:
private void FormPrincipal_LocationChanged(object sender, EventArgs e)
{
if (!movedByCode)
{
movedByCode = true;
Point puntoActual = DeviceAuxiliar.ChangeLocationForm(this.Location, this.Right, this.Bottom);
this.Location = puntoActual;
this.Location = puntoActual;
movedByCode = false;
}
}
The issues are:
1- Do I have to code Fom_LocationChanged or Form_Move?
2- When my code runs, it doesn't change the form's location. It simply does not work, but if I duplicate de line this.Location = puntoActual; it works, but with to much flickering. I'm trying to use the movedByCode flag in order to no execute twice this metod, but this does not happen neither.
Can you help me?
Thanks.
I'm having trouble when I try to change my rad form location. I wrote a code to calculate the new form position by limit the x an y position to the screen boundaries. If the user try to put the form out of the boundaries, the code reasign the location to make my form fully visible. Here's my code:
private void FormPrincipal_LocationChanged(object sender, EventArgs e)
{
if (!movedByCode)
{
movedByCode = true;
Point puntoActual = DeviceAuxiliar.ChangeLocationForm(this.Location, this.Right, this.Bottom);
this.Location = puntoActual;
this.Location = puntoActual;
movedByCode = false;
}
}
The issues are:
1- Do I have to code Fom_LocationChanged or Form_Move?
2- When my code runs, it doesn't change the form's location. It simply does not work, but if I duplicate de line this.Location = puntoActual; it works, but with to much flickering. I'm trying to use the movedByCode flag in order to no execute twice this metod, but this does not happen neither.
Can you help me?
Thanks.