以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  请教drawcell  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=93202)

--  作者:hbhb
--  发布时间:2016/11/22 19:27:00
--  请教drawcell
大师:请问drawcell事件,能否传回一个变量值,通过这个变量值,来显示对话框?也就是所与标记的颜色同步显示对话框。
--  作者:hbhb
--  发布时间:2016/11/22 19:32:00
--  
意思就是:当一张表用不同颜色标记后,有一个动态对话框。提示有数据错误。
If e.Col.IsNumeric AndAlso e.Col.Name <> "总分" Then
    If
e.Row.IsNull(e.Col.Name) = False \'且该列已经输入内容
       
If e.Row(e.Col.Name) < 60 Then \'如果该列的值小于60
            e.Style = "不及格" \'那么用"不及格"样式绘制单元格
       
End If
    End
If
End
If


--  作者:有点蓝
--  发布时间:2016/11/22 20:21:00
--  
应该在DataColChanged、ValidateEdit、AfterEdit这些事件处理。

老是想着drawcell你就误入歧途了

--  作者:hbhb
--  发布时间:2016/11/22 20:47:00
--  
自动计算可以,标记不是还要drawcell吗?
--  作者:有点蓝
--  发布时间:2016/11/22 20:54:00
--  
打开对话框提示错误就不是属于标记了
--  作者:hbhb
--  发布时间:2016/11/22 21:23:00
--  
public kz as Boolean    \'---全局变量---
dim  a ,b as Boolean
if e.Col.IsNumeric AndAlso e.Col.Name <> "总分" Then 
    If e.Row.IsNull(e.Col.Name) = False \'且该列已经输入内容
        if   e.Col.Name = "第五列"  then
        If e.Row(e.Col.Name) <> e.row("第一列") + e.row("第二列")  Then \'如果该列的值小于60
            e.Style = "不及格" \'那么用"不及格"样式绘制单元格
            a = true 
        
End If
       elseif   e.Col.Name = "第七列"  then 
        If e.Row(e.Col.Name) <> e.row("第八列") + e.row("第九列")  Then \'如果该列的值小于60
            e.Style = "不及格" \'那么用"不及格"样式绘制单元格
           b = true
        
End If
        end if
    End
 If
       if a = true and b = true  then
       kz = true
       end if
End
 
If

请问  kz变量  为何不能传送为true,就是等于false


--  作者:有点蓝
--  发布时间:2016/11/22 21:50:00
--  
因为a和b永远不会同时等于true
--  作者:有点蓝
--  发布时间:2016/11/22 21:52:00
--  
public  a ,b as Boolean \'---全局变量---

if e.Col.IsNumeric AndAlso e.Col.Name <> "总分" Then 
    If e.Row.IsNull(e.Col.Name) = False \'且该列已经输入内容
        if   e.Col.Name = "第五列"  then
        If e.Row(e.Col.Name) <> e.row("第一列") + e.row("第二列")  Then \'如果该列的值小于60
            e.Style = "不及格" \'那么用"不及格"样式绘制单元格
            a = true 
        
End If
       elseif   e.Col.Name = "第七列"  then 
        If e.Row(e.Col.Name) <> e.row("第八列") + e.row("第九列")  Then \'如果该列的值小于60
            e.Style = "不及格" \'那么用"不及格"样式绘制单元格
           b = true
        
End If
        end if
    End
 If

End If

需要判断的时候

       if a = true and b = true  then
       ‘其它处理
       end if

--  作者:hbhb
--  发布时间:2016/11/22 22:27:00
--  
public  a ,b as Boolean \'---全局变量---
public kz as Boolean    ‘----作为事件的开启变量---
if  kz = true   then
if e.Col.IsNumeric AndAlso e.Col.Name <> "总分" Then 
    If e.Row.IsNull(e.Col.Name) = False \'且该列已经输入内容
        if   e.Col.Name = "第五列"  then
        If e.Row(e.Col.Name) <> e.row("第一列") + e.row("第二列")  Then \'如果该列的值小于60
            e.Style = "不及格" \'那么用"不及格"样式绘制单元格
            a = true 
        
End If
       elseif   e.Col.Name = "第七列"  then 
        If e.Row(e.Col.Name) <> e.row("第八列") + e.row("第九列")  Then \'如果该列的值小于60
            e.Style = "不及格" \'那么用"不及格"样式绘制单元格
           b = true
        
End If
        end if
    End
 If

End If

需要判断的时候

       if a = true and b = true  then
       kz = false
messagebox.show(“有问题”)
       end if
end if

请问以上处理行不行?

--  作者:有点蓝
--  发布时间:2016/11/22 22:30:00
--  
这个只能自己测试看结果