473,954 Members | 1,993 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to keep a WinForm.ShowDia log() within the App Main Container f

Hi,

The default behavior for Modal forms does not restrict it to go out of the
client area of the main MDI container form.

I would like to show a modal form and keep it within the application
container form as any other non-modal MDI form.
I am not able to assign the MDIParent as it give an exception.

I will appreciate any suggestions.

Carlos Lozano
www.caxonline.net

Nov 17 '05 #1
1 4214
Hi Mark,

It does restrict the form to the container form client area, but causes a
boucing effect that does not look well.

It seems better using the default behavior.

Thank you anyway.

Carlos

"Mark R. Dawson" wrote:
Hi Carlos,
I do not believe this is possible since by defining the form as modal it
is a top level form and cannot be contained in any other form.

One way to fake this at a really simple level (I would like to hear from
anyone if there is a better way of doing this )would be to check in the Move
event of the child form for boundary conditions compared to the owner form
and it they are outside the boundary then automatically move the form back
inside the owner.

i.e.
Form1_ButtonCli ck()
{
Form2 f = new Form2();
f.Owner = this;

//set the position of f to be inside the owner form so that when
//it is opened it is inside the owner.

f.ShowDialog();
}
//Inside Form2 class

private void Form2_Move(obje ct sender, EventArgs e)
{
if(this.Left < this.Owner.Left )
{
this.Left = this.Owner.Left ;
}

//same for right, top and bottom
}
Mark

"Carlos Lozano" wrote:
Hi,

The default behavior for Modal forms does not restrict it to go out of the
client area of the main MDI container form.

I would like to show a modal form and keep it within the application
container form as any other non-modal MDI form.
I am not able to assign the MDIParent as it give an exception.

I will appreciate any suggestions.

Carlos Lozano
www.caxonline.net

Nov 17 '05 #2

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

Similar topics

0
1572
by: someone | last post by:
Hi, We are encountering a problem with the DTPicker. This is the situation: We have a DTPicker-control on a VB6 Active-X. The Active-X is used on a .NET winform. the problem: The .Net winform is: 1. instantiated
2
20680
by: Tom | last post by:
Hi all In winform application I am trying to start 2 forms I am trying to show the 2nd winform on a separate thread. using Thread mainapp = new Thread(new ThreadStart(loadmainscm)); mainapp.Start(); //where
6
4105
by: nadeem_far | last post by:
Hello All, I am working on a .Net desktop application and I am having problem displaying a form. I am using C# and version 1.1 of the framework. here is how the code looks likes and I will appreciate if someone can tell me how to resolve this problem. Main ( Args ) { Form1 f1 = new Form1();
1
2454
by: No Sheds | last post by:
Hi I have an MDI application. I have a MDI child window within this application that shows another form using ShowDialog. This works fine, except that the final form shown with ShowDialog can't be an MDI child window, and so can appear outside the boundaries of the main window. I know I can do something like this: private withevents FinalForm as someform
6
14943
by: randy1200 | last post by:
I'm using Visual Studio 2005 and C#. I need to print a WinForm used for data entry as a graphic. In other words, I need to print the exact WinForm the user sees on the screen. I searched through the newsgroups, and found the code below. This seems reasonable, except for the fact that the author does not provide his SetSeq_Library. This is needed to load the Bitmap variable _ActiveFormImage. Any suggestions on how to capture a WinForm...
5
10924
by: Miro | last post by:
I will try my best to ask this question correctly. I think in the end the code will make more sence of what I am trying to accomplish. I am just not sure of what to search for on the net. I have a form that has a button. ( this form is a child form of a parent form ( main form ). Anway...in this child form I have a button, and if clicked a bunch of code will get executed. I would like to show a Progress Bar / form in modal/ShowDialog...
0
1041
by: =?Utf-8?B?Sm9obk1TeXJhc29mdA==?= | last post by:
I've got a Windows Forms application. There is a form that may be shown by clicking a command button on either of 2 other forms. I use ShowDialog in all cases to get modal behavior. When the app starts up, I show a main form that is maximized and serves as the background for all three other forms. In the first case, everything works as expected when clicking the command button. The initial form closes, the second form is shown and...
2
3098
by: Ronny | last post by:
I work with VS2005 and .NET FW ver. 3.0. I need to implement 3 to 4 panes in my form application. Is that possible? Is there a way for the user to configure in real time (the pane number)? Is there some reference or a sample anywhere in the Internet that is close to that? Regards Ronny
21
3420
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 a zipcode that is unknown this form will open. I don't want users to modify any of this customers data until they close the zipcode form. Normally this can accomplished using a modal form, however this prevents me from opening a new copy of...
0
11627
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
11230
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...
0
10724
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
8301
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
7463
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
6371
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4983
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
4571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3575
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.