Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
| Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 7th, 2004, 03:22 PM
Authorized User
 
Join Date: Nov 2003
Location: Mataro, Barcelona, Spain.
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default screen resolution

Hi!

I have a form that shows an image to its original size.

But sometimes the image size is too big to fit on the screen.

I'd like to know if its possible obtain the curren screen resolution (or width and height) to fit the image to the screen size.

        public frmImagen(Byte[] pImagen)
        {
            InitializeComponent();
            //
            MemoryStream stmImagen = new MemoryStream(pImagen);
            miImagen = Image.FromStream(stmImagen);
            picImagen.Image = miImagen;
            picImagen.Size = miImagen.Size;
            this.Height = picImagen.Height;
            this.Width = picImagen.Width;
            // how to fit to screen?
        }

Thanks a lot!

-------------------------------
World only exists into your mind.
  #2 (permalink)  
Old October 7th, 2004, 04:09 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

I think you can, using the Screen object, I believe. You get the working area which is a rectangle object I believe and get the dimensions from that. It's something like that.

Brian
  #3 (permalink)  
Old October 9th, 2004, 11:58 PM
Friend of Wrox
 
Join Date: Feb 2004
Location: Bangalore, Karnataka, India.
Posts: 177
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Screen.PrimaryScreen.WorkingArea.Height
Screen.PrimaryScreen.WorkingArea.Width

Gives the screen resolution.



It is not how much we do,
but how much love we put in the doing.

-Mother Theresa


Similar Threads
Thread Thread Starter Forum Replies Last Post
Screen Resolution ajeesh_online C# 1 June 14th, 2006 12:37 AM
screen resolution Adam H-W Classic ASP Basics 3 October 13th, 2004 09:13 PM
Re sizing according to screen resolution rsamanthif VB How-To 2 August 22nd, 2004 01:24 PM
screen resolution mistry_bhavin Pro VB.NET 2002/2003 0 March 13th, 2004 02:36 PM
How to detect screen resolution pb_user Classic ASP Basics 1 August 24th, 2003 01:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.