unknown
2006-08-23 07:54:02 UTC
請教專家們:
我用VB語法想描繪出線條與文字,可是碰到宣告上的問題,可否請專家指點迷津,謝謝!
例子如下:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'在這裡放置使用者程式碼以初始化網頁
Dim BitMap1 As New Bitmap(800, 400)
Dim g As Graphics = Graphics.FromImage(BitMap1)
g.Clear(Color.Yellow)
Dim Bluepen As New System.Drawing.Pen(Color.Blue, 5)
Dim Redpen As New System.Drawing.Pen(Color.Red, 7)
Dim F As New System.Drawing.Font("arial", 10)
Dim b As New System.Drawing.Brushes(Color.Red)
g.DrawString("這是測試", F, b, 90, 20)
g.DrawLine(Bluepen, 10, 12, 100, 12)
g.DrawLine(Redpen, 100, 42, 380, 42)
BitMap1.Save(Response.OutputStream,
System.Drawing.Imaging.ImageFormat.Jpeg)
End Sub
錯誤訊息如下:
c:\inetpub\wwwroot\cgd\graph.aspx.vb(32): 無法在此內容中存取
'System.Drawing.Brushes.Private Sub New()',因為它是 'Private'。
c:\inetpub\wwwroot\cgd\graph.aspx.vb(33): 多載解析失敗,因為具備這些引數的 'DrawString'
不存在,故無法呼叫:
'Public Sub DrawString(s As String, font As System.Drawing.Font, brush
As System.Drawing.Brush, layoutRectangle As System.Drawing.RectangleF, format
As System.Drawing.StringFormat)': 型別 System.Drawing.Brushes 的值無法轉換成
System.Drawing.Brush。
'Public Sub DrawString(s As String, font As System.Drawing.Font, brush
As System.Drawing.Brush, layoutRectangle As System.Drawing.RectangleF, format
As System.Drawing.StringFormat)': 型別 Integer 的值無法轉換成
System.Drawing.RectangleF。
'Public Sub DrawString(s As String, font As System.Drawing.Font, brush
As System.Drawing.Brush, layoutRectangle As System.Drawing.RectangleF, format
As System.Drawing.StringFormat)': 型別 Integer 的值無法轉換成
System.Drawing.StringFormat。
'Public Sub DrawString(s As String, font As System.Drawing.Font, brush
As System.Drawing.Brush, point As System.Drawing.PointF, format As
System.Drawing.StringFormat)': 型別 System.Drawing.Brushes 的值無法轉換成
System.Drawing.Brush。
'Public Sub DrawString(s As String, font As System.Drawing.Font, brush
As System.Drawing.Brush, point As System.Drawing.PointF, format As
System.Drawing.StringFormat)': 型別 Integer 的值無法轉換成 System.Drawing.PointF。
'Public Sub DrawString(s As String, font As System.Drawing.Font, brush
As System.Drawing.Brush, point As System.Drawing.PointF, format As
System.Drawing.StringFormat)': 型別 Integer 的值無法轉換成 System.Drawing.StringFormat。
'Public Sub DrawString(s As String, font As System.Drawing.Font, brush
As System.Drawing.Brush, x As Single, y As Single)': 型別
System.Drawing.Brushes 的值無法轉換成 System.Drawing.Brush。
我用VB語法想描繪出線條與文字,可是碰到宣告上的問題,可否請專家指點迷津,謝謝!
例子如下:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'在這裡放置使用者程式碼以初始化網頁
Dim BitMap1 As New Bitmap(800, 400)
Dim g As Graphics = Graphics.FromImage(BitMap1)
g.Clear(Color.Yellow)
Dim Bluepen As New System.Drawing.Pen(Color.Blue, 5)
Dim Redpen As New System.Drawing.Pen(Color.Red, 7)
Dim F As New System.Drawing.Font("arial", 10)
Dim b As New System.Drawing.Brushes(Color.Red)
g.DrawString("這是測試", F, b, 90, 20)
g.DrawLine(Bluepen, 10, 12, 100, 12)
g.DrawLine(Redpen, 100, 42, 380, 42)
BitMap1.Save(Response.OutputStream,
System.Drawing.Imaging.ImageFormat.Jpeg)
End Sub
錯誤訊息如下:
c:\inetpub\wwwroot\cgd\graph.aspx.vb(32): 無法在此內容中存取
'System.Drawing.Brushes.Private Sub New()',因為它是 'Private'。
c:\inetpub\wwwroot\cgd\graph.aspx.vb(33): 多載解析失敗,因為具備這些引數的 'DrawString'
不存在,故無法呼叫:
'Public Sub DrawString(s As String, font As System.Drawing.Font, brush
As System.Drawing.Brush, layoutRectangle As System.Drawing.RectangleF, format
As System.Drawing.StringFormat)': 型別 System.Drawing.Brushes 的值無法轉換成
System.Drawing.Brush。
'Public Sub DrawString(s As String, font As System.Drawing.Font, brush
As System.Drawing.Brush, layoutRectangle As System.Drawing.RectangleF, format
As System.Drawing.StringFormat)': 型別 Integer 的值無法轉換成
System.Drawing.RectangleF。
'Public Sub DrawString(s As String, font As System.Drawing.Font, brush
As System.Drawing.Brush, layoutRectangle As System.Drawing.RectangleF, format
As System.Drawing.StringFormat)': 型別 Integer 的值無法轉換成
System.Drawing.StringFormat。
'Public Sub DrawString(s As String, font As System.Drawing.Font, brush
As System.Drawing.Brush, point As System.Drawing.PointF, format As
System.Drawing.StringFormat)': 型別 System.Drawing.Brushes 的值無法轉換成
System.Drawing.Brush。
'Public Sub DrawString(s As String, font As System.Drawing.Font, brush
As System.Drawing.Brush, point As System.Drawing.PointF, format As
System.Drawing.StringFormat)': 型別 Integer 的值無法轉換成 System.Drawing.PointF。
'Public Sub DrawString(s As String, font As System.Drawing.Font, brush
As System.Drawing.Brush, point As System.Drawing.PointF, format As
System.Drawing.StringFormat)': 型別 Integer 的值無法轉換成 System.Drawing.StringFormat。
'Public Sub DrawString(s As String, font As System.Drawing.Font, brush
As System.Drawing.Brush, x As Single, y As Single)': 型別
System.Drawing.Brushes 的值無法轉換成 System.Drawing.Brush。