B
Butt Chin Chuan
I got this error message when I try to call this line:
pbGraph.CreateGraphics.DrawLine(redPen, 250, 2500, 250,
2500)
pbGraph.CreateGraphics.DrawLine(redPen, 20, 180, 20, 180)
pbGraph.CreateGraphics.DrawLine(redPen, CInt(20.0F), CInt
(180.0F), CInt(20), CInt(180)) ' x axis
Error message displayed:
An unhandled exception of
type 'System.NotSupportedException' occurred in
System.Windows.Forms.dll
Additional information: NotSupportedException
I think the first try have the x and y point exceeded the
limit of the picture box (since I copied and modified the
code from eVB), so, I changed to the second and third
line, but the same error still occurs! What happened!
Anyone have any idea what happened? I looked into MSDN and
I still got stuck (the third line followed MSDN example).
I want to append to my earlier post. The drawString
function too gives me the same problem:
pbGraph.CreateGraphics.DrawString("0", drawFont,
drawBrush, 25, 150)
I too look into MSDN and got the following example, which
also give me error (StringFormat not supported, DrawFont
cannot fails in overload resolution because no
accessible "New" accepts this number of argument etc when
the code is actually from MSDN!) :
Public Sub DrawStringFloatFormat(e As PaintEventArgs)
' Create string to draw.
Dim drawString As [String] = "Sample Text"
' Create font and brush.
Dim drawFont As New Font("Arial", 16)
Dim drawBrush As New SolidBrush(Color.Black)
' Create point for upper-left corner of drawing.
Dim x As Single = 150F
Dim y As Single = 50F
' Set format of string.
Dim drawFormat As New StringFormat()
drawFormat.FormatFlags =
StringFormatFlags.DirectionVertical
' Draw string to screen.
e.Graphics.DrawString(drawString, drawFont, drawBrush, _
x, y, drawFormat)
End Sub
To overcome the problems (DrawFont), I have to changed it
to the following by adding an extra argument, which works
(at least I think so, unable to test out since I got stuck
calling DrawString method:
Dim drawFont As New Font("Arial", 16, FontStyle.Regular)
Any comments?
pbGraph.CreateGraphics.DrawLine(redPen, 250, 2500, 250,
2500)
pbGraph.CreateGraphics.DrawLine(redPen, 20, 180, 20, 180)
pbGraph.CreateGraphics.DrawLine(redPen, CInt(20.0F), CInt
(180.0F), CInt(20), CInt(180)) ' x axis
Error message displayed:
An unhandled exception of
type 'System.NotSupportedException' occurred in
System.Windows.Forms.dll
Additional information: NotSupportedException
I think the first try have the x and y point exceeded the
limit of the picture box (since I copied and modified the
code from eVB), so, I changed to the second and third
line, but the same error still occurs! What happened!
Anyone have any idea what happened? I looked into MSDN and
I still got stuck (the third line followed MSDN example).
I want to append to my earlier post. The drawString
function too gives me the same problem:
pbGraph.CreateGraphics.DrawString("0", drawFont,
drawBrush, 25, 150)
I too look into MSDN and got the following example, which
also give me error (StringFormat not supported, DrawFont
cannot fails in overload resolution because no
accessible "New" accepts this number of argument etc when
the code is actually from MSDN!) :
Public Sub DrawStringFloatFormat(e As PaintEventArgs)
' Create string to draw.
Dim drawString As [String] = "Sample Text"
' Create font and brush.
Dim drawFont As New Font("Arial", 16)
Dim drawBrush As New SolidBrush(Color.Black)
' Create point for upper-left corner of drawing.
Dim x As Single = 150F
Dim y As Single = 50F
' Set format of string.
Dim drawFormat As New StringFormat()
drawFormat.FormatFlags =
StringFormatFlags.DirectionVertical
' Draw string to screen.
e.Graphics.DrawString(drawString, drawFont, drawBrush, _
x, y, drawFormat)
End Sub
To overcome the problems (DrawFont), I have to changed it
to the following by adding an extra argument, which works
(at least I think so, unable to test out since I got stuck
calling DrawString method:
Dim drawFont As New Font("Arial", 16, FontStyle.Regular)
Any comments?