PC Review


Reply
Thread Tools Rate Thread

Center application window

 
 
Harold Druss
Guest
Posts: n/a
 
      7th Nov 2011
Hi
Trying to center the Excel application.
Screen resalution is 1280 x 1024
newWidth is a long and set to 800
newHeight is a long and set to 600
maxWidth is a long and set to 1280
maxHeight is a long and set to 1024

The following code moves the to far left and to far from the top.

Application.WindowState = xlNormal
Application.Width = newWidth
Application.Height = newHeight
Application.Left = (maxWidth - newWidth) / 2
Application.Top = (maxHeight - newHeight) / 2

Thanks
Harold


 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      10th Nov 2011
The screen res' is measured in pixels but the application dimensions are in
points. In most systems to convert it's typically 96 pixels per 72 points.
Simplest way to correct your routine is probably just to do this -

newWidth = 800 * 0.75
newHeight = 600 * 0.75
maxWidth = 1024 * 0.75
maxHeight = 768 * 0.75

If you are distributing to unknown users best to get the screen res and
"points to pixels" using APIs.

Regards,
Peter T

 
Reply With Quote
 
Harold Druss
Guest
Posts: n/a
 
      13th Nov 2011

"Peter T" <(E-Mail Removed)> wrote in message
news:j9gufp$tng$(E-Mail Removed)...
> The screen res' is measured in pixels but the application dimensions are
> in points. In most systems to convert it's typically 96 pixels per 72
> points. Simplest way to correct your routine is probably just to do this -
>
> newWidth = 800 * 0.75
> newHeight = 600 * 0.75
> maxWidth = 1024 * 0.75
> maxHeight = 768 * 0.75
>
> If you are distributing to unknown users best to get the screen res and
> "points to pixels" using APIs.
>
> Regards,
> Peter T


Hi Peter
I have not been online for a few days.
Thanks so much for your help.
Harold


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:10 PM.