Not sure if this is the way it's supposed to be, but after a Layout
event on an MDI form, the form's new width is set, but the MDIClient's
width is not.
As an example, start a new Windows Application, and for the code use:
Public Class Form1
Dim TextBox1, TextBox2, TextBox3 As New TextBox
Dim The_MDIClient As MdiClient
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Me.IsMdiContain er = True
Me.Height = 600
TextBox1.Locati on = New System.Drawing. Point(1, 1)
TextBox2.Locati on = New System.Drawing. Point(71, 1)
TextBox3.Locati on = New System.Drawing. Point(121, 1)
TextBox1.Size = New System.Drawing. Size(70, Me.Height - 50)
TextBox2.Size = New System.Drawing. Size(50, Me.Height - 50)
TextBox3.Size = New System.Drawing. Size(50, Me.Height - 50)
TextBox1.Multil ine = True
TextBox2.Multil ine = True
TextBox3.Multil ine = True
Me.Controls.Add (TextBox1)
Me.Controls.Add (TextBox2)
Me.Controls.Add (TextBox3)
For Each Current_Control As Control In Me.Controls
If TypeOf Current_Control Is MdiClient Then The_MDIClient =
Current_Control
Next
End Sub
Sub Show_Width(ByVa l Sub_Name As String)
If The_MDIClient Is Nothing Then Exit Sub
TextBox1.Text += Mid$(Sub_Name, 7) + vbCrLf
TextBox2.Text += The_MDIClient.C lientRectangle. Width.ToString +
vbCrLf
TextBox3.Text += Me.ClientRectan gle.Width.ToStr ing + vbCrLf
End Sub
Private Sub Form1_ResizeBeg in(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.ResizeBegin
Show_Width(Syst em.Reflection.M ethodBase.GetCu rrentMethod.Nam e)
End Sub
Private Sub Form1_Resize(By Val sender As Object, ByVal e As
System.EventArg s) Handles Me.Resize
Show_Width(Syst em.Reflection.M ethodBase.GetCu rrentMethod.Nam e)
End Sub
Private Sub Form1_ResizeEnd (ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.ResizeEnd
Show_Width(Syst em.Reflection.M ethodBase.GetCu rrentMethod.Nam e)
End Sub
Private Sub Form1_Layout(By Val sender As Object, ByVal e As
System.Windows. Forms.LayoutEve ntArgs) Handles Me.Layout
Show_Width(Syst em.Reflection.M ethodBase.GetCu rrentMethod.Nam e)
End Sub
End Class
Then resize.
Is this how it should be?
Also, is the MDIClient always the same amount less than the MDI form
itself? In this case, MDIClient.width is 4 less than Me.Width. If this
is constant, i can grab the difference in the Load event and in the
Layout event refer to Me.Width - whatever the difference is to get the
not-yet-updated MDIClient.Width .
B. 2 2328
Brian Tkatch wrote:
Not sure if this is the way it's supposed to be, but after a Layout
event on an MDI form, the form's new width is set, but the MDIClient's
width is not.
As an example, start a new Windows Application, and for the code use:
Public Class Form1
Dim TextBox1, TextBox2, TextBox3 As New TextBox
Dim The_MDIClient As MdiClient
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Me.IsMdiContain er = True
Me.Height = 600
TextBox1.Locati on = New System.Drawing. Point(1, 1)
TextBox2.Locati on = New System.Drawing. Point(71, 1)
TextBox3.Locati on = New System.Drawing. Point(121, 1)
TextBox1.Size = New System.Drawing. Size(70, Me.Height - 50)
TextBox2.Size = New System.Drawing. Size(50, Me.Height - 50)
TextBox3.Size = New System.Drawing. Size(50, Me.Height - 50)
TextBox1.Multil ine = True
TextBox2.Multil ine = True
TextBox3.Multil ine = True
Me.Controls.Add (TextBox1)
Me.Controls.Add (TextBox2)
Me.Controls.Add (TextBox3)
For Each Current_Control As Control In Me.Controls
If TypeOf Current_Control Is MdiClient Then The_MDIClient =
Current_Control
Next
End Sub
Sub Show_Width(ByVa l Sub_Name As String)
If The_MDIClient Is Nothing Then Exit Sub
TextBox1.Text += Mid$(Sub_Name, 7) + vbCrLf
TextBox2.Text += The_MDIClient.C lientRectangle. Width.ToString +
vbCrLf
TextBox3.Text += Me.ClientRectan gle.Width.ToStr ing + vbCrLf
End Sub
Private Sub Form1_ResizeBeg in(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.ResizeBegin
Show_Width(Syst em.Reflection.M ethodBase.GetCu rrentMethod.Nam e)
End Sub
Private Sub Form1_Resize(By Val sender As Object, ByVal e As
System.EventArg s) Handles Me.Resize
Show_Width(Syst em.Reflection.M ethodBase.GetCu rrentMethod.Nam e)
End Sub
Private Sub Form1_ResizeEnd (ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.ResizeEnd
Show_Width(Syst em.Reflection.M ethodBase.GetCu rrentMethod.Nam e)
End Sub
Private Sub Form1_Layout(By Val sender As Object, ByVal e As
System.Windows. Forms.LayoutEve ntArgs) Handles Me.Layout
Show_Width(Syst em.Reflection.M ethodBase.GetCu rrentMethod.Nam e)
End Sub
End Class
Then resize.
Is this how it should be?
Also, is the MDIClient always the same amount less than the MDI form
itself? In this case, MDIClient.width is 4 less than Me.Width. If this
is constant, i can grab the difference in the Load event and in the
Layout event refer to Me.Width - whatever the difference is to get the
not-yet-updated MDIClient.Width .
B.
I think i found what to do.
After locating the MDIClient, i can use AddHandler to handle the layout
event of the MDIClient, and at that point, the width is known.
B.
To be specific, new Windows Application, go to form code, and paste
this:
Public Class Form1
Dim TextBox1, TextBox2, TextBox3 As New TextBox
Dim The_MDIClient As MdiClient
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Me.IsMdiContain er = True
Me.Height = 600
TextBox1.Locati on = New System.Drawing. Point(1, 1)
TextBox2.Locati on = New System.Drawing. Point(101, 1)
TextBox3.Locati on = New System.Drawing. Point(151, 1)
TextBox1.Size = New System.Drawing. Size(100, Me.Height - 50)
TextBox2.Size = New System.Drawing. Size(50, Me.Height - 50)
TextBox3.Size = New System.Drawing. Size(50, Me.Height - 50)
TextBox1.Multil ine = True
TextBox2.Multil ine = True
TextBox3.Multil ine = True
Me.Controls.Add (TextBox1)
Me.Controls.Add (TextBox2)
Me.Controls.Add (TextBox3)
For Each Current_Control As Control In Me.Controls
If TypeOf Current_Control Is MdiClient Then
The_MDIClient = Current_Control
AddHandler The_MDIClient.L ayout, AddressOf
MDIClient_Layou t
AddHandler The_MDIClient.R esize, AddressOf
MDIClient_Resiz e
End If
Next
End Sub
Sub Show_Width(ByVa l Sub_Name As String)
If The_MDIClient Is Nothing Then Exit Sub
TextBox1.Text += Sub_Name + vbCrLf
TextBox2.Text += The_MDIClient.C lientRectangle. Width.ToString +
vbCrLf
TextBox3.Text += Me.ClientRectan gle.Width.ToStr ing + vbCrLf
End Sub
Private Sub Form1_ResizeBeg in(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.ResizeBegin
Show_Width(Syst em.Reflection.M ethodBase.GetCu rrentMethod.Nam e)
End Sub
Private Sub Form1_Resize(By Val sender As Object, ByVal e As
System.EventArg s) Handles Me.Resize
Show_Width(Syst em.Reflection.M ethodBase.GetCu rrentMethod.Nam e)
End Sub
Private Sub Form1_ResizeEnd (ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.ResizeEnd
Show_Width(Syst em.Reflection.M ethodBase.GetCu rrentMethod.Nam e)
End Sub
Private Sub Form1_Layout(By Val sender As Object, ByVal e As
System.Windows. Forms.LayoutEve ntArgs) Handles Me.Layout
Show_Width(Syst em.Reflection.M ethodBase.GetCu rrentMethod.Nam e)
End Sub
Private Sub MDIClient_Resiz e(ByVal sender As Object, ByVal e As
System.EventArg s)
Show_Width(Syst em.Reflection.M ethodBase.GetCu rrentMethod.Nam e)
End Sub
Private Sub MDIClient_Layou t(ByVal sender As Object, ByVal e As
System.Windows. Forms.LayoutEve ntArgs)
Show_Width(Syst em.Reflection.M ethodBase.GetCu rrentMethod.Nam e)
End Sub
End Class
B. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Csaba2000 |
last post by:
How do I detect when the font size has been changed (especially by user action: either Ctrl+Scroll wheel or View/Text
Size)?
This is just for use on IE 5.5+, but it would be great if there was a generic solution.
Thanks,
Csaba Gabor from New York
|
by: BillCo |
last post by:
Windows API not my strong point... can anyone give me the idiots guide
to getting the MDIClient window height (bottom of menu bar to top of
status bar) ? Basically I need a form to open up to the full availible
height flush with the left hand side without a scroll bar appearing.
Actually, it would also be pretty cool if i could trap a MDIClient
window height resize event so that the form would always be the correct
height... but I'll...
|
by: John F |
last post by:
Is there a way to place controls on the surface of MdiClient and have it
always stay in the background when new child forms are loaded into the MDI?
When I place controls on the surface of an MDI app and load child forms, the
controls place on the surface poke through the child form.
In the MDI paradigm, is it not wise/proper to use the MdiClient as a
controls surface?
--
Thanks, John F
|
by: MuZZy |
last post by:
Hi,
I'm developing an MDI application and i am having a problem: how do i
know the state of MdiClient; what i mean is: when i maximize a MDI
child, then close it and then open a new MDI child, it will open
maximized, then if i change it's state to Normal and close, then next
opened MDI child screen will have state Normal.
So i assume that MdiClient keeps state of MDI child windows even if none
of child forms exists at the moment. How...
|
by: pigeonrandle |
last post by:
Hello. I hope you are all well.
I've been trying to get the text from an MDICLIENT window (recognised
by SPY++ as 'WindowsForms10.MDICLIENT.app3').
When i try to get the text using SendMessage(WM_GETTEXT), or good old
GetText(), i get an empty string returned. Eh?
Spy++ doesn't seem to get the text either. Do i need to use some
WM_MDI* type messages or did MS leave out the handling of that message
for MDI forms? Im using Visual Studio...
| |
by: gilbert |
last post by:
Hello.
I am using .Net 2.0, C#. and am trying to put a MdiClient control into
a SplitPanel of a SplitContainer.
First, I put a SplitContainer called splitContainer1 into the form.
In the Form_Load handler, I use the following,
MdiClient mdiClient = new MdiClient();
|
by: =?Utf-8?B?bGpsZXZlbmQy?= |
last post by:
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
|
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
|
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.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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...
| |
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...
|
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,...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |