473,804 Members | 3,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Customize Windows.Forms.M diClient

Is there any way to change or turn off the border of an
Windows.Forms.M diClient 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 7858
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*******@nosp am.nospamschree f in bericht
news:03******** *************** ***********@mic rosoft.com...
Is there any way to change or turn off the border of an
Windows.Forms.M diClient 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(ByVa l sender As Object, ByVal e As EventArgs)
Handles MyBase.Load

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

End Sub

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

m_mdiclient.Doc k = DockStyle.None

m_mdiclient.Loc ation = New Point(-2, -2)

m_mdiclient.Siz e = New Size(ClientSize .Width + 4, ClientSize.Heig ht + 4)

End Sub

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

m_mdiclient.Doc k = 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*******@nosp am.nospamwrote in message
news:9B******** *************** ***********@mic rosoft.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
1566
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 Dock property to Fill. I have recently upgraded my application in the following way: -------------------------------------------------------------
0
278
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 class does not use the 'MDICLIENT' window class. I also hooked up a Messagefilter to look at the MDI messages send to the mdiclient, the only messages I saw were WM_MDISETMENU and WM_MDIREFRESHMENU. Can anyone confirm this or does anyone know...
14
4920
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 is create an MDIChild window for each service that is sending messages. Ok so far so good, but I get problems if one service is constantly sending messages to it's window because, this window is very busy updating it's view, hence because it's...
2
14026
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 MDI child window. How can I make the MDI child window appear in front of any controls that may be on the MDI parent? thanks, John
1
6343
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 etc'). is there a way making this without writing my own context menu (meaning, popup form or something) ? Please don't post commercial products to this topic thanks.
4
2932
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 can make it so that the child window are on top of the controls on the parent window. Thanks in advance. Diego
4
1692
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 control but without double buffering the flicker is unbearable. Thanks for any help! Lance
8
1673
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 see how big that is, but there must be a better way. I would have to do this in the Resize event TIA Phil.
0
1172
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 client that are horizontally align one dock on top and other is fill. - listview1 is on top on MDIClient.
0
10571
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
10326
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...
1
10317
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
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...
0
6851
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
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
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
3
2990
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.