vs.net bug? [英] vs.net bug ?

查看:58
本文介绍了vs.net bug?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当窗口状态在设计时更改时,下面的代码不会最小化窗体并且不会从代码调整窗体

的大小。


这两个案例是否与vs.net中的bug有关?


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

System.EventArgs)处理MyBase.Load


Me.Visible = False


Me.Hide()

''必须是设计时间更改


Me.WindowState = FormWindowState.Minimized


''Me.WindowState = FormWindowState.Normal


Dim x,y As String


x = 150


y = 200


Me.Width = y


Me.Height = x


Debug.WriteLine( " x& x&" y"& y)


Debug.WriteLine(" Me.Height"& Me.Height&" ; Me.Width& Me.Width)


End Sub


解决方案

这是完整的代码...

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

System.EventArgs)处理MyBase.Load


Me.Visible = False


Me.Hide()


''必须是设计时间更改


Me.WindowState = FormWindowState.Minimized


''Me.WindowState = FormWindowState.Normal


Dim x,y As String


x = 150

y = 200


Me.Width = y


Me.Height = x


Debug.WriteLine(" x" &安培; x& " y &安培; y)


Debug.WriteLine(" Me.Height"& Me.Height&" Me.Width"& Me.Width)
< br $>
End Sub


Private Sub Form1_Resize(ByVal sender As Object,ByVal e As

System.EventArgs)处理MyBase.Resize


静态我作为整数


i + = 1


Debug.WriteLine(" Resize event) & i&"& Me.Height&"& Me.Width)


End Sub


" David Gacek" <所以***** @ hotmail.com>在留言中写道

news:uk ************** @ tk2msftngp13.phx.gbl ...

后面的代码没有在设计时更改窗口状态时,不要将窗体最小化,并且不会从代码调整
窗体的大小。

这两个案例是否与vs.net中的错误相关私有Sub Form1_Load(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理MyBase.Load

Me.Visible = False

Me.Hide()

''必须是设计时间的变化

Me.WindowState = FormWindowState.Minimized
''Me.WindowState = FormWindowState.Normal

Dim x,y As String

x = 150

y = 200

Me.Width = y

Me.Height = x

Debug.WriteLine(" x"& x&" y"& ; y)

Debug.WriteLine(" Me.Height"& Me.Height&" Me.Width& Me.Width)

结束子



David,


我找不到错误。最小化和重新调整尺寸对我来说。你为什么这样:

1. Me.Visible = False?

2. Me.Hide?


我不会'' t使用字符串来保持整数。


如果我这样做:

Me.WindowState = FormWindowState.Minimized

Me.Width = 150

Me.Height = 200

然后表格开始最小化,比设计时间小很多。

Chris。

" David Gacek"写道:

当窗口状态在设计时更改时,后面的代码不会最小化窗体并且不会从窗体调整窗体的大小。<这两个案例是否与vs.net中的bug有关?

私有Sub Form1_Load(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理MyBase.Load

Me.Visible = False

Me.Hide()

''必须是设计时间变更
Me.WindowState = FormWindowState.Minimized

''Me.WindowState = FormWindowState.Normal

Dim x,y As String
x = 150

y = 200
Me.Width = y

Me.Height = x

调试.WriteLine(" x"& x&" y"& y)

Debug.WriteLine(" Me.Height"& Me.Height&"" Me.Width& Me.Width)

End Sub




< BLOCKQUOTE>& David Gacek <所以***** @ hotmail.com> schrieb:

Private Sub Form1_Load(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理MyBase.Load

Me.Visible = False

Me.Hide()




上面这些行的目的是什么?当''加载''事件处理程序执行

时,表单尚未显示...


-

MS Herfried K. Wagner

MVP< URL:http://dotnet.mvps.org/>

VB< URL:http:// dotnet。 mvps.org/dotnet/faqs/>


The code that follows doesn''t minimize the form and doesn''t resize the Form
from code when the window state is changed at design time.

Are the two cases related to a bug in vs.net ?

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

Me.Visible = False

Me.Hide()

''has to be a design time change

Me.WindowState = FormWindowState.Minimized

''Me.WindowState = FormWindowState.Normal

Dim x, y As String

x = 150

y = 200

Me.Width = y

Me.Height = x

Debug.WriteLine("x " & x & " y " & y)

Debug.WriteLine("Me.Height " & Me.Height & " Me.Width " & Me.Width)

End Sub


解决方案

This is the full code ...
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Me.Visible = False

Me.Hide()

''has to be a design time change

Me.WindowState = FormWindowState.Minimized

''Me.WindowState = FormWindowState.Normal

Dim x, y As String

x = 150

y = 200

Me.Width = y

Me.Height = x

Debug.WriteLine("x " & x & " y " & y)

Debug.WriteLine("Me.Height " & Me.Height & " Me.Width " & Me.Width)

End Sub

Private Sub Form1_Resize(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Resize

Static i As Integer

i += 1

Debug.WriteLine("Resize event " & i & " " & Me.Height & " " & Me.Width)

End Sub

"David Gacek" <so*****@hotmail.com> wrote in message
news:uk**************@tk2msftngp13.phx.gbl...

The code that follows doesn''t minimize the form and doesn''t resize the Form from code when the window state is changed at design time.

Are the two cases related to a bug in vs.net ?

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

Me.Visible = False

Me.Hide()

''has to be a design time change

Me.WindowState = FormWindowState.Minimized

''Me.WindowState = FormWindowState.Normal

Dim x, y As String

x = 150

y = 200

Me.Width = y

Me.Height = x

Debug.WriteLine("x " & x & " y " & y)

Debug.WriteLine("Me.Height " & Me.Height & " Me.Width " & Me.Width)

End Sub




David,

I can''t find a bug. The Minimize and the re-size work for me. Why are you:
1. Me.Visible = False?
2. Me.Hide?

I wouldn''t use strings to hold integers either.

If I do:
Me.WindowState = FormWindowState.Minimized
Me.Width = 150
Me.Height = 200
Then the form starts minimized and is a lot smaller than in design time.
Chris.
"David Gacek" wrote:

The code that follows doesn''t minimize the form and doesn''t resize the Form
from code when the window state is changed at design time.

Are the two cases related to a bug in vs.net ?

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

Me.Visible = False

Me.Hide()

''has to be a design time change

Me.WindowState = FormWindowState.Minimized

''Me.WindowState = FormWindowState.Normal

Dim x, y As String

x = 150

y = 200

Me.Width = y

Me.Height = x

Debug.WriteLine("x " & x & " y " & y)

Debug.WriteLine("Me.Height " & Me.Height & " Me.Width " & Me.Width)

End Sub




"David Gacek" <so*****@hotmail.com> schrieb:

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

Me.Visible = False

Me.Hide()



What''s the purpose of the lines above? When the ''Load'' event handler is
executed, the form is not yet visible...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


这篇关于vs.net bug?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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