新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
使用Line方法,向Form,PictureBox这些控件都支持这个方法。
在长海等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都做网站、网站制作 网站设计制作定制网站开发,公司网站建设,企业网站建设,高端网站设计,成都全网营销,外贸营销网站建设,长海网站建设费用合理。
语法:
object.Line [Step] (x1, 1) [Step] (x2, y2), [color], [B][F]
如:
Me.Line (100,100)-(600,600), vbred, bf
加B这个参数就是矩形,加F就是用就边框颜色填充
补充:
Color参数就是边框颜色,如果省略,就用对象的ForeColor(前景色,就是字体的颜色) 属性值
假定第一个矩形的坐标为x1,y1,宽高为w1,h1,第二个矩形的坐标为x2,y2,宽高为w2,h2:
If X2 X1 And X2 X1 + w1 And Y2 Y1 And Y2 Y1 + h1 Then
MsgBox "两个矩形有重叠,重叠区域:x=" X2 " y=" Y2 " w=" X1 + w1 - X2 " h=" Y1 + h1 - Y2
ElseIf X1 X2 And X1 X2 + w2 And Y2 Y1 And Y2 Y1 + h1 Then
MsgBox "两个矩形有重叠,重叠区域:x=" X1 " y=" Y2 " w=" X2 + w2 - X1 " h=" Y1 + h1 - Y2
ElseIf X2 X1 And X2 X1 + w1 And Y1 Y2 And Y1 Y2 + h2 Then
MsgBox "两个矩形有重叠,重叠区域:x=" X2 " y=" Y1 " w=" X1 + w1 - X2 " h=" Y2 + h2 - Y1
ElseIf X1 X2 And X1 X2 + w2 And Y1 Y2 And Y1 Y2 + h2 Then
MsgBox "两个矩形有重叠,重叠区域:x=" X1 " y=" Y1 " w=" X2 + w2 - X1 " h=" Y2 + h2 - Y1
Else
MsgBox "两个矩形没有重叠"
End If
在窗体上放置两个PictureBox请不要改任何属性,我们用代码改
请将文件命名为 1-1.bmp 1-2.bmp 1-3.bmp....
2-1.bmp 2-2.bmp....
Private Sub Form_Load()
Dim I As Long
Dim J As Long
Me.ScaleMode = 3
Picture1.ScaleMode = 3
Picture2.ScaleMode = 3
Picture2.AutoRedraw = True
Picture1.AutoRedraw = True
Picture1.AutoSize = True
Picture1.BorderStyle = 0
Picture2.BorderStyle = 0
Set Picture1.Picture = LoadPicture("C:\1-1.bmp")
'Picture1.PaintPicture Picture2.PaintPicture, 0, 0
Picture2.Width = Picture1.ScaleWidth * 4
Picture2.Height = Picture1.ScaleHeight * 4
For I = 1 To 4
For J = 1 To 4
Set Picture1.Picture = LoadPicture("C:\" CStr(I) "-" CStr(J) ".bmp")
Picture2.PaintPicture Picture1.Picture, (I - 1) * Picture1.ScaleWidth, (J - 1) * picture1.ScaleHeight
Next
Next
SavePicture Picture2.Image, "C:\All.bmp"
End Sub