| 发表于:2007-03-17 22:45:26 楼主 |
1:如果选择check1在picture上画一条线,如果选择check2在picture上画另一条线,现在单独选择check1或check2都能实现画线,但是如果同时选择check1和check2还是画一条线,就是色彩交替而已。请问如何实现同时选择check1和check2,画两条不同的线 2:模拟程序全部代码如下: dim prevp(7) as long dim picture1color(7) as long dim j dim m dim rt1 dim rt2 private sub check1_click() if check1.value = 1 then rt1 = 1 timer1.enabled = true timer1.interval = 200 else rt1 = 0 end if end sub private sub check2_click() if check2.value = 1 then rt2 = 1 timer2.enabled = true timer2.interval = 200 else rt2 = 0 end if end sub private sub form_load() for i = 0 to 7 prevp(i) = 287 next i picture1color(0) = &hff& '设置颜色为红色 picture1color(1) = &h8000& '设置颜色为色深绿色 timer3.enabled = true timer3.interval = 200 j = 35 m = 35 end sub private sub timer1_timer() dim k dim p(0) dim result2 if rt1 = 1 then '---------------------------------------温度图(t1的实现)的实现开始--------------------------------------------- if isnumeric(text1.text) then k = format(text1, "##.0 ") * 60 - 50 '+ 1950 if k <= 2050 then '程序开始的时候波动很大,35度*60-50=2050 k = 2050 end if else text4.text = "温度待测 " end if result2 = bitblt(picture5.hdc, 4, 0, picture5.width / screen.twipsperpixelx, picture5.height / screen.twipsperpixely, picture5.hdc, 0, 0, srccopy) p(0) = ((-4) * val(k) / 4095 + 3) * (picture5.height / screen.twipsperpixely) 'p = 4 * ((4095 - csng(k) - 1023) / 4095 * (picture5.height / screen.twipsperpixely)) ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '****************************** ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' if prevp(0) <> -1.003 then picture5.line (4, p(0))-(8, prevp(0)), picture1color(1) '在picture1上画线并设置颜色 prevp(0) = p(0) end if '---------------------------温度3的数据存入数据库开始------------------------------------------------------- if wendu1 < val(k) then wendu1 = val(k) end if '---------------------------------------温度图(t1的实现)的实现结束--------------------------------------------- end if end sub private sub timer2_timer() dim k dim p(1) dim result2 if rt2 = 1 then '---------------------------------------温度图(t2的实现)的实现开始--------------------------------------------- if isnumeric(text2.text) then k = format(text2, "##.0 ") * 60 - 50 '+ 1950 if k <= 2050 then '程序开始的时候波动很大,35度*60-50=2050 k = 2050 end if else text5.text = "温度待测 " end if result2 = bitblt(picture5.hdc, 4, 0, picture5.width / screen.twipsperpixelx, picture5.height / screen.twipsperpixely, picture5.hdc, 0, 0, srccopy) p(1) = ((-4) * val(k) / 4095 + 3) * (picture5.height / screen.twipsperpixely) 'p = 4 * ((4095 - csng(k) - 1023) / 4095 * (picture5.height / screen.twipsperpixely)) ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '****************************** ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' if prevp(0) <> -1.003 then picture5.line (4, p(1))-(8, prevp(0)), picture1color(2) '在picture1上画线并设置颜色 prevp(0) = p(1) end if '----------------------------温度3的数据存入数据库开始------------------------------------------------------- if wendu2 < val(k) then wendu2 = val(k) end if '---------------------------------------温度图(t2的实现)的实现结束--------------------------------------------- end if end sub private sub timer3_timer() '模拟采集卡采集到的温度 if j <= 50 then j = j + 0.01 text1.text = j end if if j = 50 then j = 35 end if if m <= 50 then m = m + 0.02 text2.text = m end if if m = 50 then m = 35 end if end sub |
|
|
|
|