How does Media Player do that resolution trick?

G

garyusenet

I've noticed that the media player window takes up the same percentage
of the screen regardless of the screen resolution, it's dimensions
aren't fixed in pixels but it takes up a set proportion of the screen.

This is exactly what i'm looking for in my simple form project i'm
trying to write.

How is this accomplished?

(to elaborate a little, at 1024x768 i opened media player and put my
finger on the screen where the window ended, then i closed media player
- then without moving my finger from the screen, i adjusted my screen
resolution to 800x600 and opened media player and the window expanded
to the same area, so it finished exactly where my finger was)
 
O

Octavius

Well you just need to know the resolution of the display and then set
the size of your form to be whatever percentage you want it to be.. I
think you can use System.Windows.Forms.Screen.GetBounds() or
System.Windows.Forms.Screen.PrimaryArea.WorkingArea to get this data.
 
J

JustinC

Octavius' solution works very well assuming there is only one screen.
You can check for the presence of multiple screens by checking
System.Windows.Forms.Screen.AllScreens which is an array of Screen
objects, or by using Screen.PrimaryScreen to just get the size and
location of the primary screen.

Hope this helps ~ Justin
 
M

Mehdi

Octavius' solution works very well assuming there is only one screen.
You can check for the presence of multiple screens by checking
System.Windows.Forms.Screen.AllScreens which is an array of Screen
objects, or by using Screen.PrimaryScreen to just get the size and
location of the primary screen.

And to get the screen where your form actually is use the
Screen.FromControl method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top