为什么第一次划就那么小, 再点一次就画得那么大?
====================================================
Private Sub Rectangle(left As Integer, top As Integer, right As Integer, bottom As Integer, color As String)
Picture1.Line (left, top)-(right, top), color
Picture1.Line (right, top)-(right, bottom), color
Picture1.Line (right, bottom)-(left, bottom), color
Picture1.Line (left, bottom)-(left, top), color
End SubPrivate Sub DrawAtable(rows As Integer, cols As Integer, color As String)
Picture1.Cls
Dim i, j, rowoffset, coloffset As Integer
Call Rectangle(30, 30, 12000, 8000, color)
rowoffset = (8000 - 30) / rows
coloffset = (12000 - 30) / cols
For i = 1 To rows - 1
Picture1.Line (30, 30 + i * rowoffset)-(12000, 30 + i * rowoffset), color
Next i
For j = 1 To cols - 1
Picture1.Line (30 + j * coloffset, 30)-(30 + j * coloffset, 8000), color
Next jEnd Sub
'
Private Sub Command1_Click()
'画线测试
For i = 1000 To 5000 Step 200
'Picture1.Line (0, i)-(8000, i), vbBlue
'Picture1.Line Step(0, 0)-Step(i, 2000), vbBlue
Next i'调用划线过程
Call DrawAtable(100, 100, vbBlue)
end sub
====================================================
====================================================
Private Sub Rectangle(left As Integer, top As Integer, right As Integer, bottom As Integer, color As String)
Picture1.Line (left, top)-(right, top), color
Picture1.Line (right, top)-(right, bottom), color
Picture1.Line (right, bottom)-(left, bottom), color
Picture1.Line (left, bottom)-(left, top), color
End SubPrivate Sub DrawAtable(rows As Integer, cols As Integer, color As String)
Picture1.Cls
Dim i, j, rowoffset, coloffset As Integer
Call Rectangle(30, 30, 12000, 8000, color)
rowoffset = (8000 - 30) / rows
coloffset = (12000 - 30) / cols
For i = 1 To rows - 1
Picture1.Line (30, 30 + i * rowoffset)-(12000, 30 + i * rowoffset), color
Next i
For j = 1 To cols - 1
Picture1.Line (30 + j * coloffset, 30)-(30 + j * coloffset, 8000), color
Next jEnd Sub
'
Private Sub Command1_Click()
'画线测试
For i = 1000 To 5000 Step 200
'Picture1.Line (0, i)-(8000, i), vbBlue
'Picture1.Line Step(0, 0)-Step(i, 2000), vbBlue
Next i'调用划线过程
Call DrawAtable(100, 100, vbBlue)
end sub
====================================================
解决方案 »
- 鄙视ID:hxh_20002这人老在论坛打广告
- MSFlexGrid1只合并某行第0列和第1列单元格问题
- mshflexgrid控件显示问题
- 我开了个FTP,允话用户上传数据,一般7M左右,我怎样用程序检查这个文件是否已经上传完毕,请指点
- RecordSet的Filter是否不支持函数?
- picture box控件画图变慢的问题
- 执行Shell "C:\Program Files\Internet Explorer\Iexplore.exe", vbNormalFocus,IE浏览器应该置顶,程序运行的时候没有置顶,用API函数S
- 请教---操作MDB时溢出
- 在 VB 中如何使用 DocumentProperties API函数在打印报表时修改打印方向及纸张尺寸(自定义纸张)。
- vb中winsock的TCP通讯问题
- 如何做像Photoshop的吸管工具的效果?
- SQL语句..................................................................
Picture1.Line (30, 30 + i * rowoffset)-(12000, 30 + i * rowoffset),
由于目前你用的是 缇,i * rowoffset 不一定是 Screen.TwipsPerPixelX 的整数倍。
所以会有一个像素的差。
Picture1.Line (left, top)-(right, top), color
Picture1.Line (right, top)-(right, bottom), color
Picture1.Line (right, bottom)-(left, bottom), color
Picture1.Line (left, bottom)-(left, top), color
End SubPrivate Sub DrawAtable(rows As Integer, cols As Integer, color As String)
Picture1.Cls
Dim i, j, rowoffset, coloffset As Integer
Call Rectangle(2, 2, 800, 500, color)
rowoffset = (500 - 2) / rows
coloffset = (800 - 2) / cols
For i = 1 To rows - 1
Picture1.Line (2, 2 + i * rowoffset)-(800, 2 + i * rowoffset), color
Next i
For j = 1 To cols - 1
Picture1.Line (2 + j * coloffset, 2)-(2 + j * coloffset, 500), color
Next jEnd Sub
'
Private Sub Command1_Click()
'画线测试
For i = 1000 To 5000 Step 200
'Picture1.Line (0, i)-(8000, i), vbBlue
'Picture1.Line Step(0, 0)-Step(i, 2000), vbBlue
Next i'调用划线过程
Call DrawAtable(100, 100, vbBlue)
End SubPrivate Sub Form_Load()
Picture1.ScaleMode = 3
End Sub