【发布时间】:2013-07-25 14:25:11
【问题描述】:
所以我一直在 Visual Basic 2010 中进行一些编程。对于我的程序,我需要确定主窗体上的某个点是否有对象 [例如 (20, 35)]。我试过了:
Dim ObjectFind as object
ObjectFind = Me.GetChildAtPoint(20, 35)
我不确定这是否有效,ObjectFind 通常等于 {System.Windows.Forms.Form} 所以我想如果 ObjectFind 不等于 {System.Windows.Forms.Form} 那我那里会有一个不同的对象,所以我做了:
If ObjectFind <> System.Windows.Forms.Form then
' Code is here
end if
但 Visual Basic 说 System.Windows.Forms.Form 不能在条件下使用。 我做了很多研究,但在 Visual Basic 中的某个点上,我没有找到太多关于如何找到对象的信息。
我也试过了:
If ObjectFind.Equals(System.Windows.Forms.Form) = false then
' Code is here
end if
我遇到了和以前一样的错误。
由于 System.Windows.Forms.Form 是我尝试的主要形式:
If ObjectFind.Equals(Me) = false then
' Code is here
end if
但是无论什么对象在 (20, 35) 处,它总是错误的
如果您不确定我的问题是:如何确定 Visual Basic 2010 中表单上的某个点是否有对象?
【问题讨论】:
-
您说,“我需要确定主窗体上的某个点是否有对象……”您所说的对象是指某种控件吗?
标签: vb.net visual-studio-2010 object