473,394 Members | 1,703 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,394 software developers and data experts.

Form with StartupPosition CenterParent not centered on parent

I have a form (sizeable border, shows in taskbar, nothing unusual), which
is the main form of my application (called MainForm). During an operation
progress is shown in another form, that is shown from within the main form
with: pf.Show(this);

I have set the StartupPosition of the form pf to CenterParent. When the
form shows, it is not centered on the parent.

How can I get the progress form to be shown centered on the main form?
Mar 22 '07 #1
1 15416
If you use ShowDialog instead of Show then I think the CenterParent
will 'take'.

To have the Modalless dialog (using Show instead of ShowDialog), then
you can manually center the pf form using code like:

Form parent = this;
pf.Location = new Point(parent.Location.X + parent.Width - 3 *
pf.Width / 2, parent.Location.Y + parent.Height - 3 * pf.Height / 2);
pf.StartPosition = FormStartPosition.Manual;
pf.Show();
==================
Clay Burch
Syncfusion, Inc.

Mar 22 '07 #2

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

Similar topics

6
by: Claus Holm | last post by:
I'm trying to enable a menuitem in the parent form from a mdichild. Rather than making the menuitems public, I'd go for a public method in the parent form to do the change, but when I call the...
2
by: cashdeskmac | last post by:
I have an application with a main form (size 300, 200) and I added another form to the project. I would like to set the second form to center on the main form. I have tried setting the parent of...
2
by: Robert W. | last post by:
In my WinForms application, I have a main form, which may or may not be visible depending on the user's wishes. This main form initiates a separate thread that starts a data transfer process. ...
3
by: Zack Sessions | last post by:
I am using VB.NET 2003. I have read the threads concerning the problem where the FormStartPosition of CenterParent is ignored if the form is displayed with the Show method as opposed to the...
37
by: Geoff Jones | last post by:
Hi Suppose I have two forms: Form1 and Form2. I create and show an instance of Form2 in the code of Form1 e.g. Dim myForm2 = New Form2 myForm2.Show() How do I tell myForm2 that Form1 is...
5
by: Charlie Brown | last post by:
I am using the following to load my mdi form into the parent. If Me.frmIncoming Is Nothing Then Me.frmIncoming = New IncomingForm Me.frmIncoming.MdiParent = Me End If Me.frmIncoming.Show()...
5
by: Bruce | last post by:
I have the StartPosition property set to CenterParent for GarXfaceUI.TransferStatus. The button below is on another form. Why isn't GarXfaceUI.TransferStatus being centered in the parent? ...
5
by: marfi95 | last post by:
I have a form that has a left and right panel. In the left panel is a treeview. The right panel I want to change dynamically based on the type of node selected. What I'm doing is loading the...
8
by: Doc John | last post by:
I have an MDI container with a child Form which will be visible according to certain events. The problem is that when I set the property Visible to False and then back to True, the Form will be in...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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.