i made a class which has speed,symbol (string "*") and location what is the acceptable way to actually display the class symbol property on the screen ?
the class will be stored in a list<OF T> and will contains hundreds dynamically instances
Printable View
i made a class which has speed,symbol (string "*") and location what is the acceptable way to actually display the class symbol property on the screen ?
the class will be stored in a list<OF T> and will contains hundreds dynamically instances
Depends how you want to display it... ? Bind the list to a listbox, gridview?
You could override the ToString method so that it returns the Symbol.
Are you able to provide any more information about what you're trying to achieve as then might be able to come up with a more detailed answer :)
ok, for learning purpose i'm trying to create "falling stars" effect, i don't have problem with the logic but i'm not sure of how to display them on the screen, my first idea was to create a dynamic label for each star but it just seem wrong approach from some reason. is it enough details ? if i need to clear anything else please ask.
thanks
You could add a Draw method to your class that takes a Graphics object as an argument. In that Draw method you would then call the DrawText method of the Graphics object to draw the Symbol. You might then, for instance, handle the Paint event of a form and do something like this:vb.net Code:
For Each item In myList item.Draw(e.Graphics) Next
Humm... to be honest I would personally have done it the way you mentioned but I agree that there probably has to be a better way, although unfortunately I'm not certain how, I would assume it would probably use the GDI+ library, but I'm not familiar with it.
Sorry I couldn't help :(
Thanks JM, I never worked with the Graphics class and on screen drawing but i believe this is the way to go i will do some reading now.
@Satal thanks again for your help, appreciated!