为什么在控件中绘制的表单会拉长? [英] Why are forms painted within controls stretched?

查看:77
本文介绍了为什么在控件中绘制的表单会拉长?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我在控件(tabpage,panel)中显示表单的所有情况下,显示表单中的

控件从

垂直拉伸约5%原版的。也就是说,如果在一个容器

控件中显示表单时,原始

表单中实际高度= 16的文本框似乎具有高度= ~18。为什么?是否有一些设置指定维持原始

维度?发生所有边框样式:

FormBorderStyle.None


FormBorderStyle.FixedToolWindow


FormBorderStyle.FixedSingle


FormBorderStyle.Fixed3D


谢谢,

Dean Slindee

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

推荐答案

Dean:我不确定这是不是一个错字,但问题是你要给一个给定的控件添加一个

表单,反之亦然?如果是后者,它听起来像锚属性(或Dock预言)的问题。

" Dean Slindee" < SL ***** @ mindspring.com>在消息中写道

新闻:eW ************* @ TK2MSFTNGP12.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...
在我展示的所有情况下控件(tabpage,panel)中的一个表单,
所示表单中的控件从
原始文件垂直拉伸约5%。也就是说,如果在
容器控件中显示表单时,原始
表单中实际高度= 16的文本框似乎具有高度= ~18。为什么?是否有一些设置指定保持原始尺寸?发生所有边框样式:
FormBorderStyle.None

FormBorderStyle.FixedToolWindow

FormBorderStyle.FixedSingle

FormBorderStyle.Fixed3D

谢谢,
Dean Slindee
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



都没有。我在容器控件中绘制一个表单。整个

绘制的表单和绘制的表单中包含的所有控件都是垂直的。

细长约5%。这是调用语句:

调用FormShowInControl(frmQueryPro,pagSearch,FormBorderStyle.None)


和子调用:

Public Sub FormShowInControl(ByVal frm As Form,_


ByRef ctl As Control,_


ByVal style As FormBorderStyle)


随着frm


..TopLevel = False


..ControlBox = False

..Parent = ctl


..FormBorderStyle = style


..显示()


..BringToFront()


..Left = 0


..Top = 0
< br $>
结束


End Sub

frmQueryPro在pagSearch(tabPage)中垂直绘制比

它实际上出现在VS Studio设计器中。 (希望它是一个视频卡问题,但我可以在整个

项目,多种形式和主机控件中始终如一地生成它)

谢谢,

Dean Slindee


" William Ryan" <做******** @ nospam.comcast.net>在消息中写道

新闻:eV ************** @ TK2MSFTNGP09.phx.gbl ...
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:我是我不确定这是不是一个错字,但问题是你要向给定的控件添加
a Form,反之亦然?如果是后者,它听起来像锚属性(或Dock预言)的问题。
Dean Slindee < SL ***** @ mindspring.com>在消息中写道
新闻:eW ************* @ TK2MSFTNGP12.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...
在我在其中显示表格的所有情况下控件(tabpage,panel),
In all instances where I show a form inside a control (tabpage, panel),


显示形式的


the

控件从原始的
垂直拉伸约5%。也就是说,如果在
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


容器中显示表单时,
原始表单中实际高度= 16的文本框的高度= ~18


container

控制。为什么?是否有一些设置指定保持原始尺寸?发生所有边框样式:
FormBorderStyle.None

FormBorderStyle.FixedToolWindow

FormBorderStyle.FixedSingle

FormBorderStyle.Fixed3D

谢谢,
Dean Slindee
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




嗨Dean,


我无法重现这个问题。这是我的测试步骤。


[Form3](添加一个TextBox和一个按钮)

Private Sub Button1_Click(ByVal sender As System.Object,ByVal e作为

System.EventArgs)处理Button1.Click

MsgBox(Me.TextBox1.Height)

End Sub

[Form1](在表单上添加一个按钮,一个TabContol和一个TabPage)

Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As

System.EventArgs)处理Button1.Click

Dim fm As New Form3

MsgBox(fm.TextBox1.Height)

Me.FormShowInControl (fm,Me.TabControl1.TabPages(0),

FormBorderStyle.FixedToolWindow)

结束子


我得到TextBox1 .Height都是20,它们在

FormShowInControl之前和之后都是平等的。

我想你可以尝试创建一个新项目,添加两个表格作为我,看看是否

问题仍然存在。


问候,

Peter Huang

Microsoft Online Partne r支持

安全! www.microsoft.com/security

此帖子是提供按原样没有保证,也没有赋予任何权利。

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.


这篇关于为什么在控件中绘制的表单会拉长?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆