Solved

Get the dimensions of a C# window

Posted on 2007-03-21
2
141 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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.   …
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

813 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now