我用VB写代码时,需要沿着Picturebox控件的边框画个矩形,我的代码如下
Private Sub Command1_Click()
    Picture1.Line (0, 0)-(Picture1.Width,Picture1.Height), , B
End Sub
结果是:画出的矩形的右下角超出了Picturebox的边框。
还请多多指教

解决方案 »

  1.   

    刚刚自己试了一下:代码应该这样写
    Private Sub Command1_Click()
        Picture1.Line (0, 0)-(Picture1.ScaleWidth, Picture1.ScaleHeight), , B
    End Sub小弟想问一下:如果使用API函数来画矩形,应该用那个函数?
      

  2.   

    Private Sub Command1_Click()
      Picture1.ScaleMode = 3
      Picture1.Line (0, 0)-(Picture1.ScaleWidth - 1, Picture1.ScaleHeight - 1), 255, B
    End Sub