| 发表于:2008-01-28 20:11:11 楼主 |
求教用extfloodfill填充区域颜色方法,谢谢!!! 如图中红色中间填满红色,绿色中间填满绿色: http://www.vbgood.com/attachments/month_0801/uvg92m28zrtda==_rkmc5nhw71l9.jpg 画图: dim maxjl as long dim i, kl as long dim mbrush as long dim crnewcolor as long dim startx as double, starty as double dim startx1 as double, starty1 as double, starty2 as double, starty3 as double if curjl + ts > ubound(hq) then maxjl = ubound(hq) else maxjl = curjl + ts end if '''''''''''''''''''''''''''''''''''''' picbroad.drawwidth = 1 picbroad.drawstyle = 0 picbroad.line (mousem3, zxj1)-(picbroad.scalewidth, mousem4), vbblack, bf picbroad.line (mousem3, mousem4)-(picbroad.scalewidth, mousem4), vbred picbroad.line (mousem3, zxj1)-(mousem3, mousem4), vbred picbroad.drawwidth = 1 picbroad.drawstyle = 2 picbroad.line (mousem3, zxj1)-(picbroad.scalewidth, zxj1), vbred picbroad.drawwidth = 1 picbroad.drawstyle = 0 ''''''''''''''''''''''''''''''' kl = 0 for i = curjl to maxjl - 1 if i = curjl then startx = (picbroad.scalewidth * 0.98 - mousem3) / ts * (i - curjl + 1) + 3 + mousem3 startx1 = (picbroad.scalewidth * 0.98 - mousem3) / ts * (i - curjl + 1) + 3 + mousem3 starty = (hy - minlow) * ((zxj1 - mousem4) / (maxhigh - minlow)) + mousem4 - 1 starty1 = (hy - minlow) * ((zxj1 - mousem4) / (maxhigh - minlow)) + mousem4 - 1 starty2 = (hy * 10 / 20 - minlow) * ((zxj1 - mousem4) / (maxhigh - minlow)) + mousem4 - 1 starty3 = (hy * 10 / 20 - minlow) * ((zxj1 - mousem4) / (maxhigh - minlow)) + mousem4 - 1 else startx1 = (picbroad.scalewidth * 0.98 - mousem3) / ts * (i - curjl + 1) + 3 + mousem3 starty1 = (hy - minlow) * ((zxj1 - mousem4) / (maxhigh - minlow)) + mousem4 - 1 starty3 = (hy * 10 / 20 - minlow) * ((zxj1 - mousem4) / (maxhigh - minlow)) + mousem4 - 1 end if if hy > hy * 10 / 20 then picbroad.line (startx, starty)-(startx1, starty1), vbred picbroad.line (startx, starty2)-(startx1, starty3), vbred 'crnewcolor = vbred 'mbrush = createsolidbrush(crnewcolor) 'selectobject picbroad.hdc, mbrush 'extfloodfill picbroad.hdc, 1, 1, getpixel(picbroad.hdc, startx + 1, starty - 1), 1 end if if hy < hy * 10 / 20 then picbroad.line (startx, starty)-(startx1, starty1), vbgreen picbroad.line (startx, starty2)-(startx1, starty3), vbgreen 'crnewcolor = vbgreen 'mbrush = createsolidbrush(crnewcolor) ' selectobject picbroad.hdc, mbrush 'picture1.line (50, 100)-(300, 300), vbgreen, b 'extfloodfill picbroad.hdc, 1, 1, getpixel(picbroad.hdc, startx + 1, starty - 1), 1 end if startx = startx1 starty = starty1 starty2 = starty3 next |
|
|
|
|