|
-
Jun 10th, 2010, 05:55 AM
#1
display class member in screen
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
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
Jun 10th, 2010, 06:12 AM
#2
Lively Member
Re: display class member in screen
Depends how you want to display it... ? Bind the list to a listbox, gridview?
-
Jun 10th, 2010, 06:15 AM
#3
Re: display class member in screen
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
If you find a response helpful then remember to Rate it
Personal website Sam Jenkins
-
Jun 10th, 2010, 06:21 AM
#4
Re: display class member in screen
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
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
Jun 10th, 2010, 06:29 AM
#5
Re: display class member in screen
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
-
Jun 10th, 2010, 06:36 AM
#6
Re: display class member in screen
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
If you find a response helpful then remember to Rate it
Personal website Sam Jenkins
-
Jun 10th, 2010, 06:45 AM
#7
Re: display class member in screen
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!
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|