vb基础

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 cxmty 的 blog

dim sngdrawwidth as single '模块级变量,保存线条宽度

private sub command1_click()'刷新恢复
form3.cls

end sub

private sub form_mousedown(button as integer, shift as integer, x as single, y as single)
 if button = 1 then   '如果按下左键
    currentx = x: currenty = y
    sngdrawwidth = 1
    drawwidth = sngdrawwidth
 end if
end sub
private sub form_mousemove(button as integer, shift as integer, x as single, y as single)
 dim lngdrawcolor as long
 if button = 1 then  '使用不同颜色
    if shift = 1 then '同时按下shift键,颜色为红色
       ingdrawcolor = rgb(255, 0, 0)
       elseif shift = 2 then '同时按下ctrl键,颜色为vbgreen
        ingdrawcolor = vbgreen
       
       elseif shift = 4 then
        ingdrawcolor = &hff000
        end if
        sngdrawwidth = sngdrawwidth + 0.1 '加宽线条
        drawwidth = sngdrawwidth
        line -(x, y), ingdrawcolor '画线
        end if
       
end sub

本文关键:鼠标画图
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top