Visual Basic.NET drawing and graphics problem

[italic]Hi!

I'm creating new project and want to use drawing and graphics to edit pictures...[/italic]

[u]I tried to import system library:[/u]

[b]Imports System.Drawing.Drawing2D[/b]

[u]and created object:[/u]

[b]Dim G As Graphics = picture.CreateGraphics[/b]

[u]I created simple utility to test writting one line:[/u]

[b] Private Sub MainLine()
X = Int(picture.Width)
Y = Int(picture.Height)
mLinePos = X / 2
Dim P As Pen = New Pen(Color.Red)
G.DrawLine(P, mLinePos, 0, mLinePos, Y)
curX = X / baseX
curY = Y / baseY
G.ScaleTransform(curX, curY)
End Sub[/b]

[u]Then Visual Basic reported error... and after removing code which was to test and object declaration and import too, project always reports the same error, look below...[/u]

[italic]Can anybody help me?

Many many thanks for everything![/italic]

[b]System.InvalidOperationException was unhandled
Message="An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an

instance of an object."
Source="The Body Analyzer"
StackTrace:
at The_Body_Analyzer.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at The_Body_Analyzer.My.MyProject.MyForms.get_Form1()
at The_Body_Analyzer.My.MyApplication.OnCreateMainForm() in C:DocumentsVisual Studio 2008ProjectsThe Body AnalyzerThe Body

AnalyzerMy ProjectApplication.Designer.vb:line 35
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at The_Body_Analyzer.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.NullReferenceException
Message="Object reference not set to an instance of an object."
Source="The Body Analyzer"
StackTrace:
at The_Body_Analyzer.Form1..ctor() in C:DocumentsVisual Studio 2008ProjectsThe Body AnalyzerThe Body AnalyzerForm1.vb:line

4
InnerException:

[/b]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories