473,508 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why are forms painted within controls stretched?

In all instances where I show a form inside a control (tabpage, panel), the
controls within the shown form are stretched vertically about 5% from the
original. That is, if a textbox with an actual height =16 in the original
form appears to have a height =~18 when the form is shown within a container
control. Why? Is there some setting that specifies "maintain original
dimensions"? Occurs with all border styles:
FormBorderStyle.None

FormBorderStyle.FixedToolWindow

FormBorderStyle.FixedSingle

FormBorderStyle.Fixed3D

Thanks,
Dean Slindee
Nov 20 '05 #1
12 1018
Dean: I'm not sure if it's a typo, but is the problem that you are adding a
Form to a given control or vice versa? If the latter, it sounds like a
problem with the anchor property (or the Dock proptery).
"Dean Slindee" <sl*****@mindspring.com> wrote in message
news:eW*************@TK2MSFTNGP12.phx.gbl...
In all instances where I show a form inside a control (tabpage, panel), the controls within the shown form are stretched vertically about 5% from the
original. That is, if a textbox with an actual height =16 in the original
form appears to have a height =~18 when the form is shown within a container control. Why? Is there some setting that specifies "maintain original
dimensions"? Occurs with all border styles:
FormBorderStyle.None

FormBorderStyle.FixedToolWindow

FormBorderStyle.FixedSingle

FormBorderStyle.Fixed3D

Thanks,
Dean Slindee

Nov 20 '05 #2
Neither. I am painting a form within a container control. The entire
painted form and all the controls the painted form contains are vertically
"elongated" by about 5%. Here is the calling statement:
Call FormShowInControl(frmQueryPro, pagSearch, FormBorderStyle.None)

and the sub called:
Public Sub FormShowInControl(ByVal frm As Form, _

ByRef ctl As Control, _

ByVal style As FormBorderStyle)

With frm

..TopLevel = False

..ControlBox = False

..Parent = ctl

..FormBorderStyle = style

..Show()

..BringToFront()

..Left = 0

..Top = 0

End With

End Sub
frmQueryPro is painted vertically larger within pagSearch (a tabPage) than
it actually appears within the VS Studio designer. (Sort of hoping it's a
video card problem, but I can consistently generate it throughout the
project, numerous forms and host controls)
Thanks,
Dean Slindee

"William Ryan" <do********@nospam.comcast.net> wrote in message
news:eV**************@TK2MSFTNGP09.phx.gbl...
Dean: I'm not sure if it's a typo, but is the problem that you are adding a Form to a given control or vice versa? If the latter, it sounds like a
problem with the anchor property (or the Dock proptery).
"Dean Slindee" <sl*****@mindspring.com> wrote in message
news:eW*************@TK2MSFTNGP12.phx.gbl...
In all instances where I show a form inside a control (tabpage, panel),

the
controls within the shown form are stretched vertically about 5% from the original. That is, if a textbox with an actual height =16 in the original form appears to have a height =~18 when the form is shown within a

container
control. Why? Is there some setting that specifies "maintain original
dimensions"? Occurs with all border styles:
FormBorderStyle.None

FormBorderStyle.FixedToolWindow

FormBorderStyle.FixedSingle

FormBorderStyle.Fixed3D

Thanks,
Dean Slindee


Nov 20 '05 #3
Hi Dean,

I can not reproduce the problem. Here are my test steps.

[Form3](Add an TextBox and a button)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
MsgBox(Me.TextBox1.Height)
End Sub

[Form1](add an button, a TabContol and a TabPage onto the form)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim fm As New Form3
MsgBox(fm.TextBox1.Height)
Me.FormShowInControl(fm, Me.TabControl1.TabPages(0),
FormBorderStyle.FixedToolWindow)
End Sub

I get the TextBox1.Height are all 20, they are equal before and after the
FormShowInControl.
I think you may try to create a new project an add two form as me to see if
the problem persists.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 20 '05 #4
* "Dean Slindee" <sl*****@mindspring.com> scripsit:
Neither. I am painting a form within a container control. The entire
painted form and all the controls the painted form contains are vertically
"elongated" by about 5%.


Is the form's width "enlongated" too?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #5
Not at all, just the height. I measured a full form's height in VS designer
at 4 7/8 inches, then in a tabPage control, expanded to 5 1/2 inches. I
also loaded the whole project onto another brand of computer with a
different video card. Same problem exactly, so it's not the video card or
the driver.

Dean Slindee
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bt************@ID-208219.news.uni-berlin.de...
* "Dean Slindee" <sl*****@mindspring.com> scripsit:
Neither. I am painting a form within a container control. The entire
painted form and all the controls the painted form contains are vertically "elongated" by about 5%.


Is the form's width "enlongated" too?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #6
Peter,

Thank you so much for devising that simple test. I lifted your code and put
it in my project.
In the designer, the textboxes are all height = 20. When I click the
button, the height value says 21.
(Which is the 5% elongation I estimated). I'm, I'm .... (speechless).

This test was run with both Microsoft and 3rd party text boxes, results were
the same.
I further took the project and installed it on a completely different PC.
Same results exactly, thus eliminating the suspicion of video card or
drivers.

Also, I nested one more form and tabcontrol within the test tabcontrol and
reran the test. Still 21, which means the elongation happens only once.

Dean

"Peter Huang" <v-******@online.microsoft.com> wrote in message
news:n6**************@cpmsftngxa07.phx.gbl...
Hi Dean,

I can not reproduce the problem. Here are my test steps.

[Form3](Add an TextBox and a button)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
MsgBox(Me.TextBox1.Height)
End Sub

[Form1](add an button, a TabContol and a TabPage onto the form)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim fm As New Form3
MsgBox(fm.TextBox1.Height)
Me.FormShowInControl(fm, Me.TabControl1.TabPages(0),
FormBorderStyle.FixedToolWindow)
End Sub

I get the TextBox1.Height are all 20, they are equal before and after the
FormShowInControl.
I think you may try to create a new project an add two form as me to see if the problem persists.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 20 '05 #7
Herfried,
See my reply to Peter above.
Dean S
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bt************@ID-208219.news.uni-berlin.de...
* "Dean Slindee" <sl*****@mindspring.com> scripsit:
Neither. I am painting a form within a container control. The entire
painted form and all the controls the painted form contains are vertically "elongated" by about 5%.


Is the form's width "enlongated" too?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #8
I forgot to mention that the spacing between the controls is also elongated
by 5%

"Peter Huang" <v-******@online.microsoft.com> wrote in message
news:n6**************@cpmsftngxa07.phx.gbl...
Hi Dean,

I can not reproduce the problem. Here are my test steps.

[Form3](Add an TextBox and a button)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
MsgBox(Me.TextBox1.Height)
End Sub

[Form1](add an button, a TabContol and a TabPage onto the form)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim fm As New Form3
MsgBox(fm.TextBox1.Height)
Me.FormShowInControl(fm, Me.TabControl1.TabPages(0),
FormBorderStyle.FixedToolWindow)
End Sub

I get the TextBox1.Height are all 20, they are equal before and after the
FormShowInControl.
I think you may try to create a new project an add two form as me to see if the problem persists.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 20 '05 #9
Found the source of the problem. The tabcontrol I'm using (from a
well-respected 3-party vendor)
is causing the problem on any controls painted within it's pages. I have
put together a test project demonstrating the problem and emailed it to the
vendor.

Thanks again for your simple test situation. I extended it to illustrate
the problem to the vendor.

Dean Slindee
"Peter Huang" <v-******@online.microsoft.com> wrote in message
news:n6**************@cpmsftngxa07.phx.gbl...
Hi Dean,

I can not reproduce the problem. Here are my test steps.

[Form3](Add an TextBox and a button)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
MsgBox(Me.TextBox1.Height)
End Sub

[Form1](add an button, a TabContol and a TabPage onto the form)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim fm As New Form3
MsgBox(fm.TextBox1.Height)
Me.FormShowInControl(fm, Me.TabControl1.TabPages(0),
FormBorderStyle.FixedToolWindow)
End Sub

I get the TextBox1.Height are all 20, they are equal before and after the
FormShowInControl.
I think you may try to create a new project an add two form as me to see if the problem persists.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 20 '05 #10
Hi Dean,

Based on further test, I find that when I set font of the TabPage from
Microsoft Sans Serif, 8.25pt to Microsoft Sans Serif, 9pt, I will get 20
before show the form in the tabpage, and get 21 after show the form in the
tabpage.

So I think you may try to take a look at if you are using the same font on
the form and the container control.

If you have any concern on this issue, please post here.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 20 '05 #11
Cor
See my reply above
Nov 20 '05 #12
Cor
Hi Dean,

When you send next time a message, can you tell that in advance, saves a lot
of times from people who try to help you?

Cor
Found the source of the problem. The tabcontrol I'm using (from a
well-respected 3-party vendor)

Nov 20 '05 #13

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

Similar topics

6
2615
by: billr | last post by:
I have developed a small API for taking care of a lot of boiler plate stuff in a multi formed windows application, for example setting up a messaging thread framework. New Forms, in the...
11
5261
by: Crirus | last post by:
I need to derive the Windows.Forms.Control 2 times so I design a class like this Public Class BMControl Inherits System.Windows.Forms.UserControl Public Class MapControl Inherits BMControl
0
1853
by: Dean Slindee | last post by:
My project has a main form (frmMain, the startup object for the project) and several other "child" forms that are painted within a large panel on frmMain. In each form's Form_Load event, a Weak...
12
4261
by: Dean Slindee | last post by:
My project has a main form (frmMain, the startup object for the project) and several other "child" forms that are painted within a large panel on frmMain. In each form's Form_Load event, a Weak...
4
2488
by: CodeLeon | last post by:
I am designing an enhanced GUI suite, and i need to know how to: * Make a user control a "helper" control, ie, one that sits at the bottom (like timer or process) * Make this control modify the...
21
3287
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...
0
7225
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
7123
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
7326
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,...
1
7046
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
7498
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...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
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...
0
1557
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 ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.