带有控件位置的IF语句作为参数 [英] IF statement with location of controls as arguments

查看:69
本文介绍了带有控件位置的IF语句作为参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个删除特定位置所有图片框的功能。

现在我有这个

 公共 功能 ClearTaskBar()
用于 < span class =code-keyword>每个 ctrl 中控制
如果 ctrl = 然后


结束 如果
下一步
结束 函数



我不知道如何将这些控件的位置用作参数。

有谁知道怎么做?

解决方案

应该这样编码:

 公共 < span class =code-keyword>功能 ClearTaskBar()
对于 每个 ctrl as control 中控制
如果 ctrl.visible 那么
' 执行某项操作
结束 如果
如果 ctrl.location.X = 0 andsoso ctrl.location.Y = 0 然后
' 做点什么
< span class =code-keyword>结束 如果
下一步
结束 功能





现在你必须决定如何处理crtl...



......但crtl只能作为控件访问 - 无论是Button还是Lable还是其他......


I want to make a function that deletes all pictureboxes at a certain location.
Right now i have this

Public Function ClearTaskBar()
    For Each ctrl In Controls
        If ctrl =  Then


        End If
    Next
End Function


and i do not know how to use the location of those controls as arguments.
Does anyone know how to do this?

解决方案

It should be coded like this :

Public Function ClearTaskBar()
     For Each ctrl as control In Controls
         If ctrl.visible  Then
            ' do something
         End If
         If ctrl.location.X=0 andalso ctrl.location.Y=0 Then
            ' do something
         End If
     Next
 End Function



Now you have to decide what to do with the "crtl" ...

... but "crtl" only is accessible as control - either if it is a Button or a Lable or whatever ...


这篇关于带有控件位置的IF语句作为参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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