Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / C++: Dark GDK v1 -?

Author
Message
Timidon
18
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 17th Mar 2014 03:30
Heres a question. I am trying to center the window that is created by DGK. I can go full screen, (such as my screen resolution is 1920 x 1080 and the window that is generated is 1024 x 768. I am trying to center that in the center of my screen. What is the best approach to do this?

There are many answers but just one question" ~ Jerilith the Mad
FG77
10
Years of Service
User Offline
Joined: 17th Mar 2014
Location:
Posted: 17th Mar 2014 13:59
Set Position of the Window:


in your example:


To get resolution of your screen:
Juggalo Memnoch
15
Years of Service
User Offline
Joined: 22nd Apr 2008
Location:
Posted: 17th Mar 2014 16:02
Here's what I do



Hope this helps

Timidon
18
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 18th Mar 2014 17:25
That's what I was trying to get was the Desktops view port so I could center it properly. So what I this system Metrics function?

// Update a few minutes later..
As scary as that is the code must be part of the basic libraries.. it just compiled and got the desired results.

! Thanks. Now I can center the window.

note: Should post this into the Code bites section...

There are many answers but just one question" ~ Jerilith the Mad
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 27th Apr 2014 08:17
The GetSystemMetrics function is part of the Windows API, specifically User32. FG77's suggestion and Juggalo Memnoch's code will produce the same result. If you prefer to center the window on the desktop client area, replace SM_CXSCREEN and SM_CYSCREEN with SM_CXFULLSCREEN and SM_CYFULLSCREEN. This function can be used to return a lot of information. For full info on this function visit msdn.
Timidon
18
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 22nd May 2014 05:14
Thanks that helped out allot. Ment to post this a while back...

There are many answers but just one question" ~ Jerilith the Mad

Login to post a reply

Server time is: 2024-04-18 11:09:04
Your offset time is: 2024-04-18 11:09:04