473,386 Members | 1,786 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,386 software developers and data experts.

Customize Windows.Forms.MdiClient

Is there any way to change or turn off the border of an
Windows.Forms.MdiClient control? In my opinion the 3D bevel that the control
uses is outdated and looks poor in my app. The best would be a single line
border that custom draw so I can control the color of the border.

Thanks for any help!
Lance

Feb 23 '07 #1
6 7820
Lance,

You can forever change everything in VB.Net. See here your border around a
textbox.

http://www.vb-tips.com/dbpages.aspx?...0-58fd21b7e2ea

Cor
"ljlevend2" <lj*******@nospam.nospamschreef in bericht
news:03**********************************@microsof t.com...
Is there any way to change or turn off the border of an
Windows.Forms.MdiClient control? In my opinion the 3D bevel that the
control
uses is outdated and looks poor in my app. The best would be a single
line
border that custom draw so I can control the color of the border.

Thanks for any help!
Lance

Feb 24 '07 #2
Hi Cor,

Thanks for the idea. Unfortunately the sample will not work for the
following reasons:

1. The sample does not address the need to change the width of the border.
2. The Paint event of the form will not necessarily be fired when the border
of its MdiClient control needs to be updated.
3. The sample will never work as it is written (even for a TextBox) because
it uses the Graphics object that is passed to the form's Paint event which
corresponds to the client area of the form, not the client area of the
control.

Any other ideas?

Thanks,
Lance

Feb 25 '07 #3
Try this.

Create a Windows Forms project and set the IsMDiContainer property to True.

Note that the MdiClient area has a sunken 3D border.

Add 2 Buttons (Button1 and Button2) to the form and add the following code.

Dim m_mdiclient As MdiClient = Nothing

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
Handles MyBase.Load

For Each _c As Control In Me.Controls
If _c.GetType Is GetType(MdiClient) Then
m_mdiclient = CType(_c, MdiClient)
Exit For
End If
Next

End Sub

Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles Button1.Click

m_mdiclient.Dock = DockStyle.None

m_mdiclient.Location = New Point(-2, -2)

m_mdiclient.Size = New Size(ClientSize.Width + 4, ClientSize.Height + 4)

End Sub

Private Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles Button2.Click

m_mdiclient.Dock = DockStyle.Fill

End Sub

'Run' the project.

Note that the MdiClient area has a sunken 3D border.

Click Button1.

Note that the MdiClient area repaints and no longer has a sunken 3D border.

Click Button2.

Note that the MdiClient area repaints and has a sunken 3D border again.

Click Button1 and then resize the form.

There is still a single, slightly darker line that appears to be around the
MdiClient area it is really the inside edge of the form border.

If you don't reposition and resize the MdiClient area when you set it's Dock
property to DockStyle.None, then it's location becomes 0,0 and it's size
becomes 0,0 which, of course becomes problems.

Have a play with that and see if it helps with what you are trying to
achieve.
"ljlevend2" <lj*******@nospam.nospamwrote in message
news:9B**********************************@microsof t.com...
Hi Cor,

Thanks for the idea. Unfortunately the sample will not work for the
following reasons:

1. The sample does not address the need to change the width of the border.
2. The Paint event of the form will not necessarily be fired when the
border
of its MdiClient control needs to be updated.
3. The sample will never work as it is written (even for a TextBox)
because
it uses the Graphics object that is passed to the form's Paint event which
corresponds to the client area of the form, not the client area of the
control.

Any other ideas?

Thanks,
Lance
Feb 26 '07 #4
Hi Lance,

I agree to what Stephany has suggested. We could get the MdiClient of a MDI
parent form and set its Dock property to None to turn off the 3D bevel
border on the MDI parent form.

As for changing the color of a form's border, I have spent some time
researching on this problem but didn't find a good way to do it.

On possible way is to override the WndProc method in the form, and catch
WM_NCPAINT message in the override method. The WM_NCPAINT message is sent
to a window when its frame must be painted. However, when we handle the
WM_NCPAINT message, we need to draw the non-client of the form by
ourselves, including the title bar, which may be much complex.

Alternatively, you could set the 'Active Window Border' or 'Inactive Window
Border' for the entire system. To do this, right-click on the destop and
choose 'Properties'. In the Display properties, switch to the Appearance
tab, and click the 'Advanced' button. In the Advanced Appearance window,
select 'Active Window Border' or 'Inactive Window Border' for the 'Item'
and then change its color.

If you have any concerns, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 26 '07 #5
Thanks Stephany. I was not aware that the border would change when the
MdiClient is not docked. That should let me do what I want.
Lance

Feb 27 '07 #6
Thanks Linda. Your help is always very much appreciated!
Lance

Feb 27 '07 #7

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

Similar topics

0
by: Trevor Germain | last post by:
Scenario: --------- I have an Explorer style application. The app hosts other win forms by making them MDI children, removing border / control box / minimize / maximize, and setting the form's...
0
by: Xzygo | last post by:
While trying to implement a MDI Application I found that the Windows.Forms classes that implement this functionality don't actually use the WIN32 MDI API. Using Spy++ I found that the MdiClient...
14
by: Brian Keating EI9FXB | last post by:
I wonder can anyone reccomment a solution to this problem. Let me explain, I've services running on my system, my application receives diagnostic messages from these services, what i want to do...
2
by: JohnR | last post by:
Let's say I have an MDI parent form with a textbox. If I create an MDI child form and, at runtime, move the MDI child window over the textbox on the MDI parent, the textbox appears in front of the...
1
by: goRide | last post by:
Hi, I'm looking of a way (preferred - a ready class or dll) to customize the context menu. many application has more controls inside the context menu (like textbox, sliders, checkbox, panel...
4
by: diego | last post by:
Hello everyone. I have an MDI form (parent) that has a number of controls on it. When I display MDI child windows, the child windows appear behind the controls that are on the parent window. How...
4
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
Is there any way to enable double buffering in an MdiClient control? I have a case where I need to hide all of the MdiClient forms and interactively draw a custom background in an MdiClient...
8
by: Phil | last post by:
Is it possible to find the size of the MDIClient area, excluding the space already used by docked controls? I have thought I could perhaps create a new control, set it's Dock property to Fill and...
0
by: my4color | last post by:
Hello every one, My development environment is c#. * Design -I have one MDI parent, it has one MDI child, -There is a toolbar on to the MDI parent. -Then there is Two list view into the MDI...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.