I use this code to calculate the padding of a button on a page from the browser border.
Dimension dm = new Dimension(1024,768); //Setting the