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

No MDI borders?

I'm trying to create an MDI form where the MDI area dosn't have the
traditional 3D borders. I thought at one point the code I had in the form
constructor was working, but now I'm getting an MDI without borders, but the
main menu on my form no longer appears. Anybody who has a little more
experience with this and is willing to help, I would appreciate it.

Thanks,
Jacob

// In MDI form constructor, after InitializeComponent.
for(int i = 0; i < this.Controls.Count; i++)

{

mdiClient = Controls[i] as System.Windows.Forms.MdiClient;

if(mdiClient != null)

{

// Get Styles using Win32 calls

int style = Win32.GetWindowLong(mdiClient.Handle, Win32.GWL_STYLE);

int exStyle = Win32.GetWindowLong(mdiClient.Handle, Win32.GWL_EXSTYLE);

// Remove any borders on the Mdi.

style &= ~Win32.WS_BORDER;

exStyle &= ~Win32.WS_EX_CLIENTEDGE;
// Set Styles using Win32 calls

Win32.SetWindowLong(mdiClient.Handle, Win32.GWL_STYLE, style);

Win32.SetWindowLong(mdiClient.Handle, Win32.GWL_EXSTYLE, exStyle);

break;

}

}
Nov 16 '05 #1
2 8798
Well, I think I got it figured out. When the code is placed in the
constructor it fails because the form and hence the MdiClient have not
gotten bounds yet. Without bounds, the function treats the whole form as the
mdi area, leaving no room for the menu, and that is what is causing the menu
to disappear.

Just put the code in the load event or other appropriate spot.

Jacob

"Jacob" <ja**********@REMOVETHIShotmail.com> wrote in message
news:uM*************@TK2MSFTNGP11.phx.gbl...
I'm trying to create an MDI form where the MDI area dosn't have the
traditional 3D borders. I thought at one point the code I had in the form
constructor was working, but now I'm getting an MDI without borders, but the main menu on my form no longer appears. Anybody who has a little more
experience with this and is willing to help, I would appreciate it.

Thanks,
Jacob

// In MDI form constructor, after InitializeComponent.
for(int i = 0; i < this.Controls.Count; i++)

{

mdiClient = Controls[i] as System.Windows.Forms.MdiClient;

if(mdiClient != null)

{

// Get Styles using Win32 calls

int style = Win32.GetWindowLong(mdiClient.Handle, Win32.GWL_STYLE);

int exStyle = Win32.GetWindowLong(mdiClient.Handle, Win32.GWL_EXSTYLE);

// Remove any borders on the Mdi.

style &= ~Win32.WS_BORDER;

exStyle &= ~Win32.WS_EX_CLIENTEDGE;
// Set Styles using Win32 calls

Win32.SetWindowLong(mdiClient.Handle, Win32.GWL_STYLE, style);

Win32.SetWindowLong(mdiClient.Handle, Win32.GWL_EXSTYLE, exStyle);

break;

}

}

Nov 16 '05 #2
Oh ya, you'll need to force the MdiClient to be recreated. Placing this
directly after the first snippet is one way.


Win32.SetWindowPos(mdiClient.Handle, IntPtr.Zero, 0, 0, 0, 0,

Win32.SWP_NOACTIVATE | Win32.SWP_NOMOVE | Win32.SWP_NOSIZE |
Win32.SWP_NOZORDER |

Win32.SWP_NOOWNERZORDER | Win32.SWP_FRAMECHANGED);



"Jacob" <ja**********@REMOVETHIShotmail.com> wrote in message
news:uM*************@TK2MSFTNGP11.phx.gbl...
I'm trying to create an MDI form where the MDI area dosn't have the
traditional 3D borders. I thought at one point the code I had in the form
constructor was working, but now I'm getting an MDI without borders, but the main menu on my form no longer appears. Anybody who has a little more
experience with this and is willing to help, I would appreciate it.

Thanks,
Jacob

// In MDI form constructor, after InitializeComponent.
for(int i = 0; i < this.Controls.Count; i++)

{

mdiClient = Controls[i] as System.Windows.Forms.MdiClient;

if(mdiClient != null)

{

// Get Styles using Win32 calls

int style = Win32.GetWindowLong(mdiClient.Handle, Win32.GWL_STYLE);

int exStyle = Win32.GetWindowLong(mdiClient.Handle, Win32.GWL_EXSTYLE);

// Remove any borders on the Mdi.

style &= ~Win32.WS_BORDER;

exStyle &= ~Win32.WS_EX_CLIENTEDGE;
// Set Styles using Win32 calls

Win32.SetWindowLong(mdiClient.Handle, Win32.GWL_STYLE, style);

Win32.SetWindowLong(mdiClient.Handle, Win32.GWL_EXSTYLE, exStyle);

break;

}

}

Nov 16 '05 #3

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

Similar topics

2
by: Hostile17 | last post by:
I've been trying to figure out a good way to make a CSS layout with nice-looking 1-pixel borders around the table cells. The only broadly compatible way to do this I know of is to have * the...
2
by: Haines Brown | last post by:
This may seem a pointless question, but I'm trying work around an inconsistency between browsers. I have a template that contains a division that holds a text that sometimes exists and sometimes...
1
by: Melissa | last post by:
A form in my database has multiple subforms. If any subform has no data, the borders of the subform still display on screen and also are printed if I print the main form. Reports are different. If...
1
by: Melissa | last post by:
Sorry if this becomes a repeat! I am having trouble with my newsreader and don't know if this got posted yeserday or not or if anyone responded. A form in my database has multiple subforms. If...
1
by: Glen Vermeylen | last post by:
Hi, For a project at school we have to automate the assignment of seats in classrooms to students during the exams. The lady who previously did everything manually kept the layouts of the...
10
by: Matt Kruse | last post by:
See: http://www.mattkruse.com/temp/offsetleft.html It appears that the offsetLeft value in IE6 (other versions not tested) incorrectly ignores the border width on a DIV when there is a width:...
7
by: steve | last post by:
Hi All I urgently need help on setting datagridview cell borders at runtime I found some code on the web from Programming Smart Client Data Applications with .NET 2.0 by Brian Noyes See...
2
by: cbjewelz | last post by:
Hey. I'm creating a horizontal boxed CSS menu for my site using lists. I wish to achieve a main menu bar something like this: http://kurafire.net/log/ however when I add borders to my code it...
9
by: Michael Redbourn | last post by:
Hi, I just switched from FP to DW and am very very happy ! So whilst I'm mastering Dreamweaver (gonna be a while yet :-) - I thought that I'd try and find out how to add borders for browers...
2
by: nicstel | last post by:
Hello, I'm trying to find documentation about the xlwt (py_excelerator). I want to change the border of some cells. But the only types that I found is: double and dashed. How to do a simple line...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
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...

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.