Results 1 to 5 of 5

Thread: Arguments to DLL functions

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Location
    Sweden
    Posts
    22

    Arguments to DLL functions

    Hi!

    I'm having some problem with a function in a DLL that I'm writing.
    I need to recieve a System.Drawing.Graphics object as an argument to this function...

    but visual studio keeps saying "Type 'System.Drawing.Graphics' is not defined"

    It doesn't work to import System.Drawing either

    This is the code I have
    Code:
    Public Shared Function drawCircle(ByVal x1%, ByVal gr As System.Drawing.Graphics) As System.Drawing.Graphics
            'Implementation
    End Function
    Why doesn't it work?

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    ByVal x1%

    What does that mean?

  3. #3
    New Member
    Join Date
    Mar 2003
    Location
    uk
    Posts
    4
    ByVal x1%

    % is equivilant to typing 'as interger'
    so you end up with a interger called x1

    ByVal means that x1's value is passed to the function instead of a reference to x1

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    I dont think % works like that in .NET.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    To start with:
    You need a reference to system.drawing.dll

    But if I am correct, you cannot create a system.drawing.graphics object (or pass it byval). The graphics object can not be seperated from the device context that provided it. If lets say a picturebox provides a graphics object, you cannot use it seperate from the picturebox. Without the device context, the graphics object is useless. Are you sure you need it byval? Byref should be no problem.
    Frans

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