C# と VB.NET の質問掲示板

わんくま同盟

ASP.NET、C++/CLI、Java 何でもどうぞ

C# と VB.NET の入門サイト


(過去ログ 75 を表示中)
■43799 / )  Visual Studio 2008
□投稿者/ kita (19回)-(2009/11/19(Thu) 10:50:15)

分類:[VB.NET/VB2005 以降] 

Private Sub printFormLine()
Dim offx As Integer
Dim offy As Integer
Dim x As Integer
Dim y As Integer
Dim Xtotal As Long = cWCode + bformlineW
Dim Ytotal As Long = cHLine * cMeisaiLines
Dim i As Integer

Dim nPenB As New Pen(Color.Black, 1.0F) ' 太ペン作成
Dim nPen As New Pen(Color.Black, 0.1F) ' 細ペン作成
Dim nPenStyle As New Pen(Color.Black, 0.1)

offx = cXMeisai
offy = cYMeisai + bhtitleY
x = offx
y = offy

printLine(nPenB, x, y, x + Xtotal, y)

nPenB.Dispose() ' ペン破棄
nPen.Dispose()
End Sub

下記のように皆で共通して使えるようにライブラリを作ろうと思っているのですがエラーが発生して
  しまいます。何がいけないのでしょうか?  
 
Module commonDRAW


Public prContext As Graphics


Public Function printLine(ByVal pPen As Pen, ByVal x1 As Integer, ByVal y1 As Integer, ByVal x2 As Integer,_
ByVal y2 As Integer) As Integer

prContext.DrawLine(pPen, x1, y1, x2, y2)
End Function
End Module

エラー内容
  NullReferenceExceptionはハンドルされませんでした。
  オブジェクト参照がオブジェクト インスタンスに設定されていません。
  とでてきます。

  どなたか解決方法教えて下さい。

返信 編集キー/


管理者用

- Child Tree -