| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 431 人关注过本帖
标题:picturebox问题
取消只看楼主 加入收藏
tanghuawei
Rank: 4
来 自:美丽的湖南
等 级:业余侠客
威 望:3
帖 子:531
专家分:220
注 册:2006-3-16
结帖率:100%
收藏
 问题点数:0 回复次数:0 
picturebox问题

我在picturebox里画矩形,并填充了它,我通过键盘vbKeyRight控制画,它一直往右画,然后用键盘vbKeyLeft,将光标至中间,然后用退格键删除,现在问题出来了,我删除了中间的,但是右边的要怎样紧跟光标向左覆盖过来呢?


代码如下,只需在桌面拖四个控件:Picture1,Line1,Timer1,Timer2


Private Sub Form_Load()
Timer1.Interval = 500
Timer2.Interval = 500
Line1.X1 = 0
Line1.X2 = 0
Line1.Y1 = 0
Line1.Y2 = Picture1.Height
Line1.BorderWidth = 4
Picture1.Move 240, 360, 6855, 1215
Line1.BorderColor = vbRed
End Sub

Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer)
Static x As Long
If KeyCode = vbKeyRight Then
x = x + 505
Picture1.AutoRedraw = True
If x Mod 2 = 0 Then
Picture1.Line (x, 0)-(x - 500, 1200), vbBlack, BF
Else
Picture1.Line (x, 0)-(x - 500, 1200), vbBlue, BF
End If
Line1.X1 = x
Line1.X2 = x
ElseIf KeyCode = vbKeyLeft Then
x = x - 505
Line1.X1 = x
Line1.X2 = x
ElseIf KeyCode = vbKeyBack Then
Picture1.Line (x, 0)-(x - 500, 1200), vbWhite, BF
x = x - 505
Line1.X1 = x
Line1.X2 = x
End If
End Sub

Private Sub Timer1_Timer()
Line1.Visible = True
End Sub

Private Sub Timer2_Timer()
Line1.Visible = False
End Sub

搜索更多相关主题的帖子: picturebox 
2007-08-14 17:00
快速回复:picturebox问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020042 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved