mercredi 6 janvier 2016

Conflict between if statement and Pin to Source

I have a if statement that I have created to check the position on a usercontrol to return where to place a form on the screen. I am looking through the steps and in the first if statement it states it was true in my first check. It skipped that one and when to the second check and it came back false and it went inside that if statement. It makes no sense to why it is behaving like that. Here is my if statements

If Convert.ToInt32(Screen.PrimaryScreen.Bounds.Width - Math.Abs(MousePosition.X)) < Convert.ToInt32(Screen.PrimaryScreen.Bounds.Width * 0.75) Then
    Return New Point(MousePosition.X + form.Width * 0.5, Screen.PrimaryScreen.Bounds.Height * 0.25)
ElseIf Convert.ToInt32((Math.Abs(MousePosition.X) - (form.Width + (form.Width * 0.5)))) < 0 Then
    Return New Point(20, Screen.PrimaryScreen.Bounds.Height * 0.25)
Else
    Return New Point(MousePosition.X - (form.Width + (form.Width * 0.5)), Screen.PrimaryScreen.Bounds.Height * 0.25)
End If

I have never had this happen before.

Aucun commentaire:

Enregistrer un commentaire