====有关使用Shape控件用作移动边框的疑问:如何使Shapre边框始终在前====

alj 2004-11-23 12:10:20
100分求救,具体如下:

新建一个工程,在默认的Form1上放置两个不相干的Picture1和Picture2,再放置一个Shape矩形框,将Picture2尽量拉大一些。并在Form1里面插入如下代码:

Option Explicit

Dim bx As Integer
Dim by As Integer

Dim oLeft As Integer
Dim oTop As Integer
Dim oWidth As Integer
Dim oHeight As Integer

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
bx = X
by = Y

oLeft = Picture1.Left
oTop = Picture1.Top
oWidth = Picture1.Width
oHeight = Picture1.Height
End If
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Shape1.Move oLeft + (X - bx), oTop + (Y - by), oWidth, oHeight
End If
End Sub

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Picture1.Move Shape1.Left, Shape1.Top
End If
End Sub

运行程序,用鼠标按住Picture1,可以发现有个Shape边框,但是每当Shape移动Picture2上时就被遮住,如何克服这个问题?
...全文
149 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
aiur2000 2004-11-23
  • 打赏
  • 举报
回复
换成text1,backcolor设置为&H8000000F&,appearance设置为0-flat,就可以解决了
Option Explicit

Dim bx As Integer
Dim by As Integer

Dim oLeft As Integer
Dim oTop As Integer
Dim oWidth As Integer
Dim oHeight As Integer

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
bx = X
by = Y

oLeft = Picture1.Left
oTop = Picture1.Top
oWidth = Picture1.Width
oHeight = Picture1.Height
End If
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Text1.Visible = True
Text1.Move oLeft + (X - bx), oTop + (Y - by), oWidth, oHeight
End If
End Sub

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Picture1.Move Text1.Left, Text1.Top
Text1.Visible = False
End If
End Sub
射天狼 2004-11-23
  • 打赏
  • 举报
回复
发完了,接收吧!!
alj 2004-11-23
  • 打赏
  • 举报
回复
To:cuizm(射天狼)

我的Email:aljcn@csclgz.com
alj 2004-11-23
  • 打赏
  • 举报
回复
aiur2000(开始.NET):你的思路达不到我需要的效果。
射天狼 2004-11-23
  • 打赏
  • 举报
回复
我有一个控件设计的例子,要的话给我发消息!!

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧