Solved

Get the dimensions of a C# window

Posted on 2007-03-21
2
142 Views
Last Modified: 2013-12-17
Hi all, coding C# in VS.Net 2003

I need to get the width of my main window.  Could someone provide a code sample?
0
Comment
Question by:alexatsearidge
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 18764217
From where?...

From within the main form itself, use the Size() property:
http://msdn2.microsoft.com/en-us/library/system.windows.forms.form.size.aspx

     this.Size.Width

If you are not in the main form then you need a reference to it...
0
 

Author Comment

by:alexatsearidge
ID: 18764269
Yeah... I don't know why I wasn't doing that.  Realized it after a couple of minutes.  Thanks.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question