473,785 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how moving a secondary form

Hi,

I'm trying to move a secondary form to the main form's center. But this does
not work with the code I try. Can someone explain ?

Form1 is my seond form. And this is menu item click from main form:

private void aboutToolStripM enuItem_Click(o bject sender, EventArgs e)
{
Point loc = new Point();
Form1 about = new Form1();
loc.X = Location.X + (Size.Width - about.Size.Widt h) / 2;
loc.Y = Location.Y + (Size.Height - about.Size.Heig ht) / 2;
about.Location = loc;
//about.Show(this );
about.ShowDialo g();
}

--
rgds, Wilfried
http://www.mestdagh.biz
Nov 16 '05 #1
3 1039
On Wed, 26 Jan 2005 04:23:02 -0800, Wilfried Mestdagh wrote:
Hi,

I'm trying to move a secondary form to the main form's center. But this does
not work with the code I try. Can someone explain ?


<snip>code to try to manually center the form</snip>

Why not just set the StartPosition on your secondary form to CenterParent?
--
Tom Porterfield
Nov 16 '05 #2
Hi Tom,

Thank you. That works as a glance, But still Im wondering wy the other did
not work. In some applications I will put a form for example on a known or
preivious place (eg position / size saved in config file) ?

rgds, Wilfried
Nov 16 '05 #3
On Wed, 26 Jan 2005 05:41:02 -0800, Wilfried Mestdagh wrote:
Hi Tom,

Thank you. That works as a glance, But still Im wondering wy the other did
not work. In some applications I will put a form for example on a known or
preivious place (eg position / size saved in config file) ?

rgds, Wilfried


If you want to manually set the start position on your form, then you need
to set the StartPosition property on the form to Manual. It should then
use the Location you specify.
--
Tom Porterfield
Nov 16 '05 #4

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

Similar topics

4
2063
by: R.G. Vervoort | last post by:
Does anyone have a suggestion how I can order a list with names in a secondary select string. The first string selects a number of locations where people work From this string I get several id's form people (in the location table there
1
1770
by: barbara | last post by:
We've all data and log files located in SAN mount point. In case of primary server crash, is it possible to unmount the volumes and remount at secondary server? Do we have any problems with master DB moving this way. Detach,attach or backup/restore are not our options. Thanks
7
2837
by: hank | last post by:
Hi All In the Circular Logging when the Primary Log file fill up, the database manager will creat a secondary log files for the transaction; when this transaction finished, the secondary log files still allocated in log directory; when all application disconnect from database or database reactive or database restart the secondary log files will be deleted from log directory. For each transaction log request, database manager always...
2
11789
by: BG | last post by:
We're having trouble writing the code to update a UI control (label.Text) from a secondary thread. We're using C# with Windows Forms. We have a main form named MainForm, a splash screen form named SplashScreen, and a C# class library named BackgroundProcess.
3
3770
by: Dale Lundgren | last post by:
I have a c# class library that launches a Win Form in a secondary thread. From the Form (now running in the secondary thread) I need to be able to start a method that is defined in the class and have it run in the main thread. I have read many examples and tried numerous approaches based on delegates all of which will launch the method, but never in the main thread, always in the secondary thread. Is what I'm trying to accomplish...
6
1163
by: John Dann | last post by:
I have a main form and then a secondary form that allows entry of some settings. I want to show the secondary form modally (I guess using ..ShowDialog), but I'd like it shown against the background of the main form. At present using frm2.showdialog eg from a main form menu click causes the main form to disappear from the background, which is a little disorientating for the user. Is this the standard behaviour of ShowDialog or have I got...
4
8096
by: Zorpiedoman | last post by:
In a multi-monitor environment, a form I am creating at run time keeps placing itself on the primary screen, even if the main form of the program making the call is on the secondary screen. How do I place a form on the secondary screen (monitor)? -- --Zorpie
2
9379
by: Diogo Alves - Software Developer | last post by:
Greetings I would like to knowhow can I put a sliding panel... I've done this: if (panel1.Width < 300) { while (panel1.Width < 300) { panel1.Width = panel1.Width + 40;
4
1149
by: Ed Bitzer | last post by:
Appreciate some direction as to what most of you professionals do when passing some limited variables to another form. A simple example would be passing the location of a second form. I could use a constructor which I think of as parameters attached to the creation of my New form (parameters) or I could use "properties" as I have learned to use with classes. Some advice please. Ed
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10327
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.