Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Programmatically Placing a From

Posted on 2006-11-07
4
220 Views
Last Modified: 2010-04-16
Hi,
How do i Programmatically place a form on the screen?  I have a need to place it off center when the program starts?
0
Comment
Question by:schenkp
  • 3
4 Comments
 
LVL 11

Expert Comment

by:Jase-Coder
ID: 17894692
Hi

You can use the following method:

public static void SetWindowPosition (
      int left,
      int top
)


this method can only be used in .NET 2 and above
0
 
LVL 11

Accepted Solution

by:
Jase-Coder earned 500 total points
ID: 17894710
sorry that was a mistake. That method is for setting ths position of a console window. To set the position of Window you can do:

this.Top = whatever;
this.Left = whatever;
0
 

Author Comment

by:schenkp
ID: 17894712
Can you show me one with values please....
0
 
LVL 11

Expert Comment

by:Jase-Coder
ID: 17894750
yeh no problem

button a button on a form and do

        private void button1_Click(object sender, EventArgs e)
        {
            this.Top = 20;
            this.Left = 40;
        }
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wav problem 4 28
Video Player 2017 5 35
List<PaisEntity> - show some 1 28
Release Dynamically Allocated Memory in C# 3 38
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

840 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