Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / April 2005

Tip: Looking for answers? Try searching our database.

Currently position my windows form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
harry - 22 Apr 2005 11:56 GMT
Hi
How can i set Currently position of my window form.
for example:

x  = this.Location.X;
y  = this.Location.Y;

//(x=199, y =200);
//i want to set my windows form in x(10,20)????

Thanks!!
Morten Wennevik - 22 Apr 2005 12:39 GMT
Hi Harry,

I think you need to rephrase your question as I'm not sure what you mean.

You can reposition your form using its Location property

this.Location = new Point(10, 20);

The initial position of your form is controlled by windows unless you specify the StartPosition property to something other than FormStartPosition.WindowsDefaultLocation, for instance FormStartPosition.Manual.

Signature

Happy coding!
Morten Wennevik [C# MVP]

Peder Y - 22 Apr 2005 17:25 GMT
...and you must set it in your Load event or later, not in the constructor.

- Peder -

> Hi Harry,
>
[quoted text clipped - 8 lines]
> FormStartPosition.WindowsDefaultLocation, for instance
> FormStartPosition.Manual.
Morten Wennevik - 22 Apr 2005 18:10 GMT
You can set the location in the constructor, but if you are using Visual Studio, beware that Location is set inside InitializeComponent so you need to set it after the call to InitializeComponent.

> ...and you must set it in your Load event or later, not in the constructor.
>
[quoted text clipped - 12 lines]
>> FormStartPosition.WindowsDefaultLocation, for instance
>> FormStartPosition.Manual.

Signature

Happy coding!
Morten Wennevik [C# MVP]


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.