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

Home Posts Topics Members FAQ

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 15529
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.Lo cation.X + parent.Width - 3 *
pf.Width / 2, parent.Location .Y + parent.Height - 3 * pf.Height / 2);
pf.StartPositio n = FormStartPositi on.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
6221
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 method from the mdichild, I get this error: C:\MyProjects\Visual Studio Projects\Tournament\Forms\frmLogin.cs(69): The name 'test' does not exist in the class or namespace 'Tournament.frmLogin' frmLogin is the mdichild.
2
9532
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 the second form to be the first form using: this.Parent = Form1; (both with and without the ( )) but that doesn't work, otherwise I could set the CentreParent property for Form2. I also tried adding the following to the constructor of Form1:
2
6157
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. In this thread I want to show a special dialog box. Because the question must be answered, I'm using ShowDialog to display it. Just before doing so, I have some simple code to: - Center it in the main form, if that form is visible - Center it in...
3
4733
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 ShowDialog method. I am having a similar problem and I found a thread that had the following code in the child form's Load event: Me.Location = New Point(( _ Me.MdiParent.ClientSize.Width - Me.Width) * 0.5,
37
2071
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 its parent? That is, when I look at either "Parent" or "ParentForm" in Form2, they both show "Nothing".
5
5615
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() Me.frmIncoming.Location = New Point(10, 450) When the forms Show() method is called and before the location is
5
1585
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? Private Sub RxWaypoints_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles RxWaypoints.Click
5
8583
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 treeview nodes through an XML file. As part of each node in the XML, I'm using an attribute that indicates the name of a sub form to load. As part of all these little child forms, the main control is a panel, which I then assign its parent to the...
8
4010
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 another location, or it will be maximized. Why does the child Form change its location when the Visible propery is set true (after being set to False)? Why doesn't it stay with the same Size and the same Location? Thanks.
0
9030
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6525
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
5861
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
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3052
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
2
2333
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
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.