Expand mobile version menu
  Skip to main content

Artificial Intelligence Specialist

Real-Life Activities

Real-Life Math -- Solution

In computer programming, the origin of the coordinates is the top left of the screen. So in order to center the dialog box, you must calculate how far down from the top left corner the dialog box must be placed. Then you must figure out how far right from the left part of the screen the dialog box must be placed. The formulas are as follows:

First, you calculate the top position:

top = (screen height / 2) - (form height / 2)
top = (768 / 2) - (500 / 2)
top = 384 - 250
top = 134

Now, calculate the left position:

left = (screen width / 2) - (form width / 2)
left = (1024 / 2) - (500 / 2)
left = 512 - 250
left = 262

Now that we have the calculations, we realize that in order to center the dialog box on the screen, we need to place the top of the box 134 pixels from the top and 262 pixels from the left.


Contact

  • Email Support

  • 1-800-GO-TO-XAP (1-800-468-6927)
    From outside the U.S., please call +1 (424) 750-3900

Support


Powered by XAP

OCAP believes that financial literacy and understanding the financial aid process are critical aspects of college planning and student success. OCAP staff who work with students, parents, educators and community partners in the areas of personal finance education, state and federal financial aid, and student loan management do not provide financial, investment, legal, and/or tax advice. This website and all information provided is for general educational purposes only, and is not intended to be construed as financial, investment, legal, and/or tax advice.