Fix potential exception that I was ignoring.
This can happen, so we should handle it
This commit is contained in:
parent
794d45fdeb
commit
ba0180ed77
1 changed files with 7 additions and 4 deletions
|
@ -54,10 +54,13 @@ namespace OpenTK
|
|||
}
|
||||
|
||||
private int GetYOffset(){
|
||||
System.Drawing.Point offset = control.PointToScreen(control.Location);
|
||||
System.Drawing.Point windowOffset = control.TopLevelControl.PointToScreen(System.Drawing.Point.Empty);
|
||||
int relativeY = offset.Y-windowOffset.Y; //control.TopLevelControl.Location.Y is not the same as windowOffset.Y for some reason.
|
||||
return control.TopLevelControl.ClientSize.Height - control.Bottom - relativeY;
|
||||
if (control.TopLevelControl != null) {
|
||||
System.Drawing.Point offset = control.PointToScreen (control.Location);
|
||||
System.Drawing.Point windowOffset = control.TopLevelControl.PointToScreen (System.Drawing.Point.Empty);
|
||||
int relativeY = offset.Y - windowOffset.Y; //control.TopLevelControl.Location.Y is not the same as windowOffset.Y for some reason.
|
||||
return control.TopLevelControl.ClientSize.Height - control.Bottom - relativeY;
|
||||
}
|
||||
return control.Location.Y;
|
||||
}
|
||||
|
||||
#region IGLControl Members
|
||||
|
|
Loading…
Reference in a new issue