Results 1 to 2 of 2

Thread: GDI+ with Visual Basic.NET - Please Help

Hybrid View

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2001
    Posts
    46

    GDI+ with Visual Basic.NET - Please Help

    I want to use GDI+ in VB.NET, so I have been trying to draw a line first, but I think I `m doing something wrong ; VB.NET gives error as : An unhandled exception of type 'System.NullReferenceException' occurred in C:\MY DOCUMENTS\VISUAL STUDIO PROJECTS\WINDOWSAPPLICATION3\BIN\WINDOWSAPPLICATION3.EXE

    The code is :

    Imports System.ComponentModel
    Imports System.Drawing
    Imports System.WinForms


    Public Class Form1
    Inherits System.WinForms.Form

    Public Sub New()
    MyBase.New

    Form1 = Me

    'This call is required by the Win Form Designer.
    InitializeComponent

    'TODO: Add any initialization after the InitializeComponent() call
    End Sub

    'Form overrides dispose to clean up the component list.
    Overrides Public Sub Dispose()
    MyBase.Dispose
    components.Dispose
    End Sub

    #Region " Windows Form Designer generated code "

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.Container

    Dim WithEvents Form1 As System.WinForms.Form

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Private Sub InitializeComponent()
    Me.components = New System.ComponentModel.Container()
    '@design Me.TrayHeight = 90
    '@design Me.TrayLargeIcon = False
    '@design Me.TrayAutoArrange = True
    Me.Text = "Form1"
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(424, 317)

    End Sub

    #End Region


    Private Sub DrawALine()
    Dim e As PaintEventArgs
    Dim myPath As New Drawing2D.GraphicsPath()
    myPath.AddLine(10, 50, 100, 150)
    Dim myPen As New Drawing.Pen(Color.Black, 2)
    e.Graphics.DrawPath(myPen, myPath)
    End Sub

    Public Sub Form1_Paint(ByVal sender As Object, ByVal e As System.WinForms.PaintEventArgs) Handles Form1.Paint
    DrawALine()
    End Sub

    End Class

    I really need to use GDI+

    Would you please help

    Thanks in advance

  2. #2

    Thread Starter
    Member
    Join Date
    Jul 2001
    Posts
    46

    Thumbs up

    OK mates, I recently fixed the problem.
    Sorry for the inconvenience.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width