以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]关于brush 的问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=153936)

--  作者:81538475
--  发布时间:2020/8/27 23:31:00
--  [求助]关于brush 的问题
Dim rc As Integer=255
Dim gc As Integer=0
Dim bc As Integer=0
Dim Datet As new List(of String)
Datet.Add("1")
Datet.Add("2")
Datet.Add("3")
\'Datet.Add("4")
\'Datet.Add("5")
\'Datet.Add("6")
\'Datet.Add("7")
\'Datet.Add("8")
Dim BRS As List(OF brush)


For i As Integer =   1 To Datet.Count-1  \'---加载笔刷
    If bc> 0 AndAlso bc <> 200 Then
        bc = bc - (cint(val(200) / Datet.Count))
        
        If BC < 0 Then
            BC=0
        End If
    Else
        bc = 0
    End If
    BC=GC
    \'Dim br0 As brush = New SolidBrush(Color.FromARGB(255,rc,gc,bc))
    BRS.Add(New SolidBrush(Color.FromARGB(255,rc,gc,bc)))
Next
brush 是不是不能加入list 这个报错了。应该如何处理呢。

---------------------------
版本:2020.5.29.8
---------------------------
代码执行出错,错误信息:



System.NullReferenceException: 未将对象引用设置到对象的实例。

   在 UserCode.Test()
---------------------------
确定   
---------------------------

[此贴子已经被作者于2020/8/27 23:32:01编辑过]

--  作者:有点蓝
--  发布时间:2020/8/28 9:06:00
--  
Dim BRS As new List(OF brush)