以前在VB6中可以用scale方法来缩放picturebox的坐标系,在VB.NET这个方法不行了,请教一下该用什么办法来替代呢?
主要想通过VB.NET在picturebox中画曲线。
------解决方案--------------------
这是我一个项目中的代码,你自己看吧!data(NowDataIndex).X = NowDataIndex
data(NowDataIndex).Y = b
ReDim LPointArray(NowDataIndex)
YMax = 40 '设置测量范围
YMin = -10
For i = data.GetLowerBound(0) To data.GetUpperBound(0)
If data(i).Y > YMax Then YMax = data(i).Y
If data(i).Y < YMin Then YMin = data(i).Y
Next
ScaleFactorX = data.Length : ScaleFactorY = YMax - YMin '计算x,y轴比率
pScalex = PictureBox1.Width / ScaleFactorX
pScaley = (PictureBox1.Height * 0.97) / ScaleFactorY
For i = LPointArray.GetLowerBound(0) To LPointArray.GetUpperBound(0)
LPointArray(i).X = data(i).X * pScalex
LPointArray(i).Y = (YMax - data(i).Y) * pScaley
Next
If LPointArray.Length > 1 Then
gr.DrawLines(RedPen, LPointArray) '画图
End If
PictureBox1.Image = bm '将背景绘图数据放到图片框中
PictureBox1.Refresh() '重新显示
gr.Dispose() '清除画布
RedPen.Dispose() '清除资源
------解决方案--------------------
http://hi.baidu.com/hyyly520/item/e93f3053b8fc37938c12eda2