Winform Activeform Location of X and Y coordinate C# code
Posted on 2011-10-15
I am trying to use the current x, and y position of the active form, to determine the current x and y mouse coordinates for a given (webbrowser) in the Main form of the application. As coordinates of the form will change depending on resolution, I am looking to ensure the mouse coordinates displayed are always only current with the browser form.
int NewTopBorderValueX = Main.ActiveForm.DesktopBounds.Location.X;
int NewTopBorderValueY = Main.ActiveForm.DesktopBounds.Location.Y;
I set up the above two variables to subtract these values when the form position changes from 0,0.
However, it asking me to use the new keyword to create an instance of the object. However, I am confused because the instance of the object is the active form.
Any suggestions on how I need to create a new instance of the active form.