473,320 Members | 2,073 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,320 software developers and data experts.

Opening Child Windows

How you you make C# code where on a button click it will open a window at a
certain size and position on the screen? I can't find any examples other
than VB and trying to covert it to C# has not been successful.
Nov 16 '05 #1
3 3476
Brain,

Your ques is kinda not clear. Based on my understanding will try to reply
you.

1. Positioning form in the screen

Form testForm = new Form();
testForm.Left = 100; //x Pos
testForm.Top = 100; //y Pos
testForm.Show();

2. Fixing Size of the form

Form testForm = new Form();
testForm.Width = 400; //for example
testForm.Height = 500; //for example
testForm.Show();

If testForm is a MDIChildWindow, then x and y will be considered from the
parent window, not from the desktop. To positon form based on the desktop
coordinates, you have to convert the point to Screen points using
PointToScreen Function.

If testForm is not a MDIChildWindow, then it will be positioned based on
desktop co-ordinates.

Shak

"Brian Conway" <Br**********@qwest.com> wrote in message
news:uo**************@TK2MSFTNGP10.phx.gbl...
How you you make C# code where on a button click it will open a window at a certain size and position on the screen? I can't find any examples other
than VB and trying to covert it to C# has not been successful.

Nov 16 '05 #2
Brian,

Can you show the examples in VB?

You should be able to set the Location property on the Form to indicate
where on the screen you want it to appear.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Brian Conway" <Br**********@qwest.com> wrote in message
news:uo**************@TK2MSFTNGP10.phx.gbl...
How you you make C# code where on a button click it will open a window at a certain size and position on the screen? I can't find any examples other
than VB and trying to covert it to C# has not been successful.

Nov 16 '05 #3
Brain,

Your ques is kinda not clear. Based on my understanding will try to reply
you.

1. Positioning form in the screen

Form testForm = new Form();
testForm.Left = 100; //x Pos
testForm.Top = 100; //y Pos
testForm.Show();

2. Fixing Size of the form

Form testForm = new Form();
testForm.Width = 400; //for example
testForm.Height = 500; //for example
testForm.Show();

If testForm is a MDIChildWindow, then x and y will be considered from the
parent window, not from the desktop. To positon form based on the desktop
coordinates, you have to convert the point to Screen points using
PointToScreen Function.

If testForm is not a MDIChildWindow, then it will be positioned based on
desktop co-ordinates.

Shak

"Brian Conway" <Br**********@qwest.com> wrote in message
news:uo**************@TK2MSFTNGP10.phx.gbl...
How you you make C# code where on a button click it will open a window at a certain size and position on the screen? I can't find any examples other
than VB and trying to covert it to C# has not been successful.

Nov 16 '05 #4

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

Similar topics

1
by: Tim Stageberg | last post by:
To All - I am trying to open a fully functioning windows app in a child form of a MDI application. Can anyone point me in a direction on how to do that? The application that I am playing with...
5
by: VM | last post by:
When I try to open a window (this small window is 198x190 in size) through the MDI menu with: frm_export frmExport = new frm_export(); frmExport.MdiParent = this; frmExport.Show(); it opens...
0
by: Jack Addington | last post by:
I have a 'quickadd' type window for doing quick data entry. The window is launch from a MDI child and is suppose to be a re-sizable popup/child window. This is an excel type datagrid for doing...
3
by: Maheshkumar.R | last post by:
Hi groups, How i can command over the MDI CHIlD forms created dynamically at runtime from PARENT. Let say, i have generated 5 mdichild forms, but i want to work with child form1 from MDI...
2
by: Prabhudhas Peter | last post by:
If I click a menu to open a form which already open...the vb.net opens a new window while existing open window is there...i want to restric the opening of a new instance of an already opened...
2
by: Peter W Johnson | last post by:
Hi Guys, I have a problem opening a child window within a parent window when passing a variable between two child windows. I have the parent window setup with two menuitems. The first calls...
2
by: Lenster | last post by:
Environment --------------- Visual Studio.NET 2003 Version 7.1.3088 ..NET Framework 1.1 Version 1.1.4322 SP1 XP Professional 5.1.2600 SP2 Build 2600 Problem Description...
11
by: Tony K | last post by:
I have a MDI application. On the menu toolstrip child forms are selected from one of the menus. I don't want to play the disable/enable menu item game. I have selected that open forms are added...
1
by: Mucker | last post by:
This could be a difficult one, so please bear with me. I've an assembly containing Delphi 2006.NET forms. A C# app, via reflection opens these forms . This works fine - I've a C# app, opening...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.