Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

How do I calculate width&height with dpi in win32

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
4 replies to this topic

#1 noatom   Members   

925
Like
0Likes
Like

Posted 27 February 2014 - 02:55 PM

So I want to create a tab control in a window,but the CreateWindow function in win32 expect me to send the width&height in device coords...

I know the screen coords size(480x800),but I have no ideea how to convert that.

 

I tried with: LPtoDP() but after the call it doesn't change the point structure so it still leaves me with (480x800)....

 



#2 wack   Members   

1358
Like
0Likes
Like

Posted 27 February 2014 - 04:14 PM

You can use

double ratio = GetDeviceCaps(myhdc, LOGPIXELSX) / 96.0;

And then multiply your pixel values with that.

#3 noatom   Members   

925
Like
0Likes
Like

Posted 27 February 2014 - 06:26 PM

i get ratio = 1??



#4 wack   Members   

1358
Like
0Likes
Like

Posted 27 February 2014 - 06:31 PM

Then perhaps you need to tell Windows that your application is DPI
aware, you can do that either via a manifest or by simply calling SetProcessDPIAware.

#5 noatom   Members   

925
Like
0Likes
Like

Posted 27 February 2014 - 06:58 PM

that worked






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.