What's wrong whith my test graphing usercontrol's code?
下面是我新做的一个用VB编的测试用的控件的原代码, 其编译、运行时都没有显示任何问题,但当我将其运行之后,在其缺省状态下,即IE浏览器条件下打印该图形时,却显示出如下错误,
run-time error '6'
overflow
UserControl.CurrentX = (UserControl.ScaleWidth - UserControl.TextWidth(该行代码在 paint事件中)
请各位高手给予指导!
************************************************************************
Const m_def_Title = "test"
Dim m_Title As String
Dim plotdata() As Double
'Event Declarations:
'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=13,0,0,test
Public Property Get Title() As String
Title = m_Title
End Property
Public Property Let Title(ByVal New_Title As String)
m_Title = New_Title
PropertyChanged "Title"
End Property
'Initialize Properties for User Control
Private Sub UserControl_InitProperties()
m_Title = m_def_Title
End Sub
Private Sub UserControl_Paint()
Dim i As Integer
Dim j As Integer
UserControl.CurrentY = 200
UserControl.CurrentX = (UserControl.ScaleWidth - UserControl.TextWidth(m_Title)) / 2
'print Title
UserControl.Print m_Title
' darw a line
UserControl.Line -(ScaleWidth / 2, 1000)
End Sub
'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
m_Title = PropBag.ReadProperty("Title", m_def_Title)
End Sub
Private Sub UserControl_Resize()
Dim i As Integer
Dim j As Integer
UserControl.CurrentY = 200
UserControl.CurrentX = (UserControl.ScaleWidth - UserControl.TextWidth(m_Title)) / 2
'print Title
UserControl.Print m_Title
' darw a line
UserControl.Line -(ScaleWidth / 2, 1000)
End Sub
'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
Call PropBag.WriteProperty("Title", m_Title, m_def_Title)
End Sub
'