Results 1 to 2 of 2

Thread: [RESOLVED] n00b in vb.net 2005

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2006
    Posts
    8

    Resolved [RESOLVED] n00b in vb.net 2005

    Hi. Im new here and new to vb.net 2005, even pretty new to programming. I'm making a simple game. I want to know how to assign the shapes youve drawn to variables. This draws an ellipse on the drawing surface, drawingspot.DrawEllipse(penvariable, x, y, 3, 3). How would you be able to get an ellipse assigned to a variable like 'ellip1'? I need to be able to do this becuase then I want use commands like ellip1.top, ellip1.move. I have seen my friend do this kind of thing in vb6 but it looked easy, vb.net 2005 is different, so im stuck. Also im sure vb6 had a shape tool, which looked really easy, it seems to have gone in .net.

    Cheers for any help

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: n00b in vb.net 2005

    Welcome to the forums.

    I haven't tried this, so I looked around a bit. There could be a better way, but if you are drawing an elipse using DrawEllipse, it looks like the best way to do it is to create a rectangle object (call it rec for example), then call the function with:

    drawingspot.DrawElipse(penvariable,rec)

    Of course, the ellipse itself will not be retained as a variable, but both the pen and the rectangle CAN be retained. In fact, if you were to create a custom class or structure like this:

    VB Code:
    1. public structure Ellipse
    2.  public myPen as 'Heck, what IS a pen, is it system.drawing.pen?
    3.  public myRect as Rectangle
    4. end structure

    A structure of type Ellipse will contain all the information you would need to draw an ellipse, so it effectively IS an ellipse. You could add a member function DrawMe which would draw the ellipse. Quite likely, you'd want to make those member variables private and permit access through properties, but if you are new to it, you might overlook that for now.
    My usual boring signature: Nothing

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