line、 shape 控件的大小、位置的这些属性不都有的吗?你在程序中设置就可以了。
如果需要随时添加,减少的话可以使用数组控件的。
如果需要随时添加,减少的话可以使用数组控件的。
解决方案 »
- 怎么写
- 我使用vbs 写了一个 function 我想使用一个调用function 中的返回值,如下!
- 如何使数据库中符合要求的数据显示?
- 对:关于MSCOMM控件,如何将一串16进制的还原成10进制?高手请请进,急急急!!!(2004chenlong)帖子中函数的致欠声明
- 菜鸟问题:写好vb程序后如何使用它
- DataGrid加CheckBox
- 动态数组赋值的问题求教
- 一个关于format或convert的问题,
- 急需建树的算法!!
- 急急急急!在VB6.0中怎样用MSXML的方法来判断一个XML文件是否符合XML Schema的格式?
- 请问:如何读取webbrowser中的数据?回答满意送50分(在线等候)
- !诚征合作伙伴 !
Line1.X1=0
Line1.X2=1200
Line1.Y1=30
Line1.Y2=30shape1.Left=0
shape1.top=0
shape1.width=450
shape1.height=450
Line1.X1=0
Line1.X2=1200
Line1.Y1=30
Line1.Y2=30shape1.Left=0
shape1.top=0
shape1.width=450
shape1.height=450
end sub
下面是个简单的示例,实际的判断要复杂一些:Dim m As Boolean
Dim px, pyPrivate Sub Form_Load()
m = False
End SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If X > Shape1.Left And X < Shape1.Width + Shape1.Left Then
m = True
px = X
py = Y
End IfEnd SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If m = True Then
Shape1.Move X - px + Shape1.Left, Y - py + Shape1.Top
px = X
py = Y
End If
End SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
m = False
End Sub
Shape1.Left = X
Shape1.Top = Y
End Sub
还想问一下,我怎样才知鼠标当前所选的是line(index),还是shape(index)?
是不是我用picturebox预载图片(先定义好的,能代替line shape的),也可实现同样的效果?但问题是我有可能加载上1000个同样的控件,会不会影响程序的运行?
图片框占用的资源较多,不推荐使用。
速度最快,最节省资源的办法就是设计自己的shape类。用多少就new多少。