473,395 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Setting the Screen Location of Windows Forms

Hi all,

I've some difficulties with the screen/form locations.

When I fist set my location of the form and then the execute the show
command the form is located at "WindowsDefaultLocation".

Based on that I've created the following procedure:

/// <summary>

/// Set the specified window's size and location.

/// The size is only adjusted if both the width and
height are > 0

/// </summary>

public void Set(System.Windows.Forms.Form form)

{

if(form != null)

{

if(m_visible)

{

form.Show();

form.Refresh();

}

if(m_width>0 && m_height>0)

form.Size = new
Size(m_width, m_height);

form.Location = new
Point(m_X, m_Y);

form.Refresh();

}

}

But now you're able to see that the location will be changed.

What can I do about this?

Thanks in advance,

Gaby
Nov 15 '05 #1
1 3797
Hi,

I may not getting you right, but you can change the FormStartPosition
property value to "Manual" and then set the values of the Size and Location
properties in code or in the designer. Then, when you invoke the Show()
method, the form will be displayed in the specified position and will have
the requested bounds.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"G Uljee" <le***@xs4all.nl> wrote in message
news:40*********************@news.xs4all.nl...
Hi all,

I've some difficulties with the screen/form locations.

When I fist set my location of the form and then the execute the show
command the form is located at "WindowsDefaultLocation".

Based on that I've created the following procedure:

/// <summary>

/// Set the specified window's size and location.

/// The size is only adjusted if both the width and height are > 0

/// </summary>

public void Set(System.Windows.Forms.Form form)

{

if(form != null)

{

if(m_visible)

{

form.Show();

form.Refresh();
}

if(m_width>0 && m_height>0)
form.Size = new Size(m_width, m_height);

form.Location = new
Point(m_X, m_Y);

form.Refresh();

}

}

But now you're able to see that the location will be changed.

What can I do about this?

Thanks in advance,

Gaby


Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: | last post by:
Hi, I am setting the NumericUpDown .Value property and the ValueChanged event is NOT being fired. Does this ONLY get fired when I change it on the UI and not programatically? Thanks
0
by: Stuart Norris | last post by:
Dear Group, I am attempting to write a "splash" and "status" Form using a second thread. I wish to use this Form to display status information to the user when I do CPU intensive work in my...
0
by: Stuart Norris | last post by:
Dear Group, I am having a problem setting SocketOptionName.SendTimeout on a client TCPIP application using the sockets in .NET. From the on-line help it is possible to set a...
1
by: Rachel Suddeth | last post by:
I have an form where the whole display is a tab control (well, that plus a status bar.) I want to set the focus to the first TextBox on the first TabPage when it loads. I tried to put that into...
1
by: BillZondlo | last post by:
Can someone look at this and tell me why, when I call this from my main app, it displays fine (fades form in and out) but then before my main app displays, I see other dialog boxes flash...
0
by: Steve | last post by:
I am working on an application to screen scrape information from a web page. I have the base code working but the problem is I have to login before I can get the info I need. The page is hosted on...
9
by: dana lees | last post by:
Hello, I am developing a C# asp.net application. I am using the authentication and authorization mechanism, which its timeout is set to 60 minutes. My application consists of 2 frames - a...
3
by: steve | last post by:
Hi All I have textboxes within a TableLayoutpanel and I want to be able to position an independant control adjacent to a selected textbox This independent control allows selection of text to...
8
by: Andrus | last post by:
..NET 2 Winforms application. How to create new setting and set it default value in userSettings section of app.config file or overwrite existing setting value ? I found code below in this list...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.