vb画图的问题
我做的一个程序 当点击计算出现进度条窗体 主窗体开始画图 画完后 卸载进度条窗体 然后画完的图也没了 然后我将绘图函数放在卸载进度条窗体后测试 同样出现画好的图闪了一下就没了 画图函数以前编的 应该没有问题
'绘图函数
Public Sub DrawPoint(pic1 As Control, m_xx#(), m_yy#())
Dim n%, i%, lx#, ly#, m_xx1#(8), m_yy1#(8)
Dim xmax#, ymax#, xmin#, ymin#
n = UBound(m_xx)
xmax = m_xx(0)
xmin = m_xx(0)
ymax = m_yy(0)
ymin = m_yy(0)
For i = 1 To n
If xmax <= m_xx(i) Then xmax = m_xx(i)
If ymax <= m_yy(i) Then ymax = m_yy(i)
If xmin >= m_xx(i) Then xmin = m_xx(i)
If ymin >= m_yy(i) Then ymin = m_yy(i)
Next
lx = xmax - xmin: ly = ymax - ymin
pic1.Scale (xmin - lx / 13, ymax + ly / 10)-(xmax + lx / 13, ymin - ly / 10)
For i = 0 To n
pic1.PSet (m_xx(i), m_yy(i)), RGB(225, 0, 0)
Next
pic1.DrawStyle = 2
For i = 1 To 8
m_xx1(i) = xmin + (i - 1) * (xmax - xmin) / 7
m_yy1(i) = ymin + (i - 1) * (ymax - ymin) / 7
With pic1
.CurrentY = ymin - ly / 30
.CurrentX = m_xx1(i) - lx / 26
.FontName = "宋体"
.FontSize = 8
End With
pic1.Print Format(m_xx1(i), "#00")
With pic1
.CurrentX = xmin - lx / 12.5
.CurrentY = m_yy1(i) + ly / 30
.FontName = "宋体"
.FontSize = 8
End With
pic1.Print Format(m_yy1(i), "#00.000")
Next
[解决办法]
画图的窗口或者控件的autoredraw属性设置为true
[解决办法]
既pic1.Autoredraw=true