找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
查看: 5172|回复: 2

画直线问题

[复制链接]

15

主题

26

回帖

0

精华

金牌会员

学习ing.

积分
2450
发表于 2006-4-28 20:15:53 | 显示全部楼层 |阅读模式
帮我看看这代码..只能画水平线...不能画任意角度的直线...请大家帮我修改一下... Option Explicit Dim MouseDowned As Boolean Dim oleX As Single Dim oleY As Single Dim NewX As Single Dim NewY As Single Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) MouseDowned = True oleX = X oleY = Y NewX = oleX NewY = oleY End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If MouseDowned Then If Button = vbLeftButton Then Me.Line (oleX, oleY)-(NewX, NewY) NewX = X: NewY = Y End If End If End Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) MouseDowned = False End Sub
我们明天在电脑前, 时间就从身边流过了, 流走了我们的生命,而留给我们什么呢? 流走了我们的朋友,而我们得到冷血的代码!值得吗? 如果对于那些奋斗N年的程序员来说,那是何等的伤害啊 希望中国的程序员朋友们看准你们的将来

15

主题

26

回帖

0

精华

金牌会员

学习ing.

积分
2450
 楼主| 发表于 2006-4-28 20:17:06 | 显示全部楼层
<p>倒..怎么代码成这样子..</p><p>Option Explicit</p><p>Dim MouseDowned As Boolean<br/>Dim oleX As Single<br/>Dim oleY As Single<br/>Dim NewX As Single<br/>Dim NewY As Single</p><p>Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)<br/>&nbsp;&nbsp;&nbsp; MouseDowned = True<br/>&nbsp;&nbsp;&nbsp; oleX = X<br/>&nbsp;&nbsp;&nbsp; oleY = Y<br/>&nbsp;&nbsp;&nbsp; NewX = oleX<br/>&nbsp;&nbsp;&nbsp; NewY = oleY<br/>End Sub</p><p>Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)<br/>&nbsp;&nbsp;&nbsp; If MouseDowned Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Button = vbLeftButton Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.Line (oleX, oleY)-(NewX, NewY)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NewX = X: NewY = Y<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br/>&nbsp;&nbsp;&nbsp; End If<br/>End Sub</p><p>Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)<br/>&nbsp;&nbsp;&nbsp; MouseDowned = False<br/>End Sub<br/></p>
我们明天在电脑前, 时间就从身边流过了, 流走了我们的生命,而留给我们什么呢? 流走了我们的朋友,而我们得到冷血的代码!值得吗? 如果对于那些奋斗N年的程序员来说,那是何等的伤害啊 希望中国的程序员朋友们看准你们的将来

15

主题

26

回帖

0

精华

金牌会员

学习ing.

积分
2450
 楼主| 发表于 2006-4-29 20:19:16 | 显示全部楼层
嗯 ..之前搞错了..现在好了..
我们明天在电脑前, 时间就从身边流过了, 流走了我们的生命,而留给我们什么呢? 流走了我们的朋友,而我们得到冷血的代码!值得吗? 如果对于那些奋斗N年的程序员来说,那是何等的伤害啊 希望中国的程序员朋友们看准你们的将来
您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

快速回复 返回顶部 返回列表