以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  结果和我预想的不一样  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=85439)

--  作者:rjh4078
--  发布时间:2016/5/25 20:48:00
--  结果和我预想的不一样

我在panel p1中动态添加了一组按钮 并在窗口click事件中加入下面代码

但是 只要单击panel就会触发按钮事件  怎么回事

 


For Each c As WinForm.Control In e.Form.Controls("p1").children    
    If Typeof c Is WinForm.button  AndAlso c.name.StartsWith("btn") Then
        Dim b As WinForm.button = c       
            \'\'MessageBox.show(c.name)
            Dim fl As String =  ProjectPath & "bin\\temp\\" &  b.text
            \'\' MessageBox.show(fl)
            If FileSys.FileExists(fl)  Then \'如果本地存在同名文件且CRC校验值相同
                \'则直接使用本地文件
            Else \'否则从数据库提取文件
                Dim tj As String
                tj=c.name.Replace("btn-","")
                Dim dr As DataRow=DataTables("附件").sqlfind("uid=\'" & tj.Split("-")(0) & "\' and 文件名=\'" & tj.Split("-")(1) & "\'")
                If dr IsNot Nothing Then
                    If dr.SQLLoadFile("附件",fl) = True Then \'如果提取文件失败
                        \'\'Messagebox.Show("附件提取失败,可能并不存在附件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
                        Return
                    End If
                End If
            End If
            Dim Proc As New Process \'打开文件
            Proc.File = fl
            Proc.Start()
       
    End If
Next


--  作者:大红袍
--  发布时间:2016/5/25 20:51:00
--  

 判断Click事件的 e.Sender 啊