Solved

Programmatically Placing a From

Posted on 2006-11-07
4
217 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

11 Experts available now in Live!

Get 1:1 Help Now