473,394 Members | 1,770 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.

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 3481
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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.