Results 1 to 13 of 13

Thread: Simple DirectX Graphics problem

  1. #1
    Lively Member
    Join Date
    Jul 04
    Posts
    83

    Question Simple DirectX Graphics problem

    Ladies and Gentlemen,
    Your help please.
    I'm currently converting a C# program into VB.NET. I can't get hold of the author and I don't know any C# programmers, and now I'm stuck! I don't consider myself a C# programmer - yet

    The problem lies when I run the C# code. It builds with no errors However, when I run the C# code it grumbles at this line (see below):


    Code:
    // This call is required by the Windows.Forms Form Designer.
    InitializeComponent();
    backGroundColor = Color.Blue;
    bitmap = new  Bitmap("MyPointer.bmp"); <- *** THIS LINE *** :confused:
    bitmap.MakeTransparent( Color.Black );
    The error message says:
    An unhandled exception of type 'System.ArgumentException' occurred in system.drawing.dll
    Additional information: Invalid parameter used.


    Any help is gratefully received

    Kerrang

    PS
    MyPointer is a small bitmap on a User Control.
    There are two references one to Microsoft.DirectX and one to Microsoft.DirectX.DirectDraw.

  2. #2
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 02
    Location
    Nottingham
    Posts
    2,176
    Do you need the full path for the bitmap???
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  3. #3
    Lively Member
    Join Date
    Jul 04
    Posts
    83
    It seems I don't. I have tried with the full path but get the same error. I have since ported this to VB.NET and I get the same error message.

  4. #4
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 02
    Location
    Nottingham
    Posts
    2,176
    Your variable name isnt considered reserved is it? Eg bitmap as Bitmap
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  5. #5
    Lively Member
    Join Date
    Jul 04
    Posts
    83
    Aaah! good point... But no. However, I did change it to prove it:

    Code:
    backGroundColor = Color.Blue;
    bit_map = new  Bitmap("MyPointer.bmp");
    bit_map.MakeTransparent( Color.Black );
    ..but alas, I get the same error message.

  6. #6
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 02
    Location
    Nottingham
    Posts
    2,176
    Sounds like they might have added an extra parameter that needs to be passed to it

    I havent got VB.net so I cant look

    Does this make any sense to you?
    New Bitmap(Filename:="filename")
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  7. #7
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 02
    Location
    Nottingham
    Posts
    2,176
    Dim bit As Bitmap = New Bitmap(Me.Width, Me.Height)

    anything? This has height and width params
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  8. #8
    Lively Member
    Join Date
    Jul 04
    Posts
    83
    I've tried this with your information:
    Code:
    BackGroundColor = Color.Blue
    bit_map = New Bitmap("MyPointer.bmp", 56, 152)
    bit_map.MakeTransparent(Color.Black)
    but with no luck

  9. #9
    Lively Member
    Join Date
    Jul 04
    Posts
    83
    I forgot to say that the named parameter (:="filename") didn't work either!

  10. #10
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 02
    Location
    Nottingham
    Posts
    2,176
    Does it come up with the list of required parameters when you type???

    e,g Bitmap(Height,Width,Filename)

    etc
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  11. #11
    Lively Member
    Join Date
    Jul 04
    Posts
    83
    yep!
    The Bitmap class is overloaded with 12 options.
    Code:
    bit_map = New Bitmap("MyPointer.bmp", 56, 152)
    is legal. However, I'm converting code from C# to VB.NET and since they are both .NET languages there shouldn't be a problem with parameters

    When I run this line I get:
    Cast from string "MyPointer.bmp" to Integer not valid
    or something silimlar.

    So I 've gone back to:
    Code:
    bit_map = New Bitmap("MyPointer.bmp")
    for now...
    Since the original code has this.

    I'm beginning to think it could be a .NET bug!
    I'm still working on it though

  12. #12
    KING BODWAD XXI BodwadUK's Avatar
    Join Date
    Aug 02
    Location
    Nottingham
    Posts
    2,176
    You try a different file?
    If you dribble then you are as mad as me

    Lost World Creations Website (XBOX Indie games)
    Lene Marlin

  13. #13
    Lively Member
    Join Date
    Jul 04
    Posts
    83
    Nice one, I didn't think of that! I was so focused on this bit map.
    :
    :
    .. I've just tried another bitmap on my User Control . This time I can get the user control to stay on the form but when I run it I get the same error message.

    So, this has given me food for thought Something, in the way .NET handles/loads bitmaps maybe?

    For now I will just draw a line and use that as my pointer until I can get to the bottom of this.

    BodwadUK, thanks for your efforts it is appricated. I haven't given up though I'll try again later today.

    Kerrang

Posting Permissions

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