| 发表于:2007-06-19 15:47:122楼 得分:0 |
你试一下这个:我刚刚改的: imports system.drawing imports system.drawing.drawing2d public class form1 dim _graphicpic as graphics dim startpoint as point dim endpoint as point dim ismousedown as boolean = false private sub pctbox_mousedown(byval sender as object, byval e as system.windows.forms.mouseeventargs) handles pctbox.mousedown ismousedown = true startpoint.x = e.x startpoint.y = e.y end sub private sub pctbox_mousemove(byval sender as object, byval e as system.windows.forms.mouseeventargs) handles pctbox.mousemove if ismousedown then endpoint.x = e.x endpoint.y = e.y end if end sub private sub pctbox_mouseup(byval sender as object, byval e as system.windows.forms.mouseeventargs) handles pctbox.mouseup _graphicpic.drawline(pens.black, startpoint, endpoint) ismousedown = false end sub private sub pctbox_paint(byval sender as object, byval e as system.windows.forms.painteventargs) handles pctbox.paint end sub private sub form1_load(byval sender as object, byval e as system.eventargs) handles me.load _graphicpic = pctbox.creategraphics() end sub end class | | |
|