VB.NET Restrictions? Real-Time Rendering?

Joined
Apr 14, 2006
Messages
9
Programming Experience
1-3
I love how easy it is to design forms with VB.NET - But I can't seem to do anything else? I am trying to draw bezier splines in realtime, like building an editor.

Basically, is it possible to design things like MAP EDITORS, SPLINE EDITORS, ART PROGRAMS, ETC?

Because all the controls seem to be event based and not real-time based? Where are the real-time controls? I can't even seem to find any documentation on this either, does anyone know if VB.NET is even capable of any realtime rendering?
 
Starters

I just read your last post and I can see that I was partially correct in assuming that you are a little nieve to OOP. I will help you out with this b/c I think I can break it down really simple for you. I also grew from BASIC, QBASIC, C++, PASCAL and so forth before VB. I only slightly messed with VB 6.0 for only a few months. Then I quit programming until .NET 2003, in which I started with 2002. Now I am current with 2005 and I think I understand where you are coming from. Drawing graphics on QBASIC was fun and simple. However; now it can be done tons better. Let's build some graphics code together to get you caught up with VB 2005. Or whichever version your interested in actually.

Basically, let's talk about Threads.

When you run a New Thread you have to imagine starting another program to run inside your program. The thread runs simultaniously with your current program. So to answer your question, No the Thread is not still in the Form Load. We Declared the thread in the Forms Class and then assigned a value to the thread in the Forms Load. The thread was activated when we ran the thread.start() method. The Form Load ended and was over. No more load. Depends on where you want to put your graphics. You can draw on the form, re-draw the form, draw in a picture box, panel, groupbox, textbox, label, ect. You choose where to draw the graphics. I have three suggestions though. A picturebox or panel, the Form itself, or another form.

I know this may sound intense but you really need to go backwards a lil and learn .NET programming. This will get you caught up on all the things that are happening. There are too many things for me to explain and i think I will wind up teaching you a lot of basic things first before we start graphics. I can and will help you for now build graphics applications but your going to be lost later I fear. Please grab a VB .NET or 2005 Step by Step book and read through it. Then I can asnwer any questions you have partaining to it.


But for now, starting simple and having you learn as we go let's do the code. I will work on a small graphics program that I think you can learn from and as I do tell me what you want to build. Remember, let's start small b/c I don't want you to just make it but understand how I am accomplishing it.

You might think I am a jerk now but if you deal with me and everyone here and let us help you, I think you will be most pleased and confident in building your graphics just the way you want them.
 
Thanks fro your post, I dont think you're a jerk :)

Regarding newbie books:
They're going to teach me how to drag and drop input boxes. They're going to teach me what variables are. What the difference between integers and floats are, etc. This is stuff I already know :(

Ok, so then they'll teach me that I can drag and drop a control onto a form (oh my!! :eek: ) and then they'll show me that in the lower-right corner there are properties I can change (which are self explanitory)

THat is why I dont want to read them. I skiffed through the msdn documentation and the getrting started docs and they didnt go over graphics at all. Just boring control manipulation.

I understand that. I just want to know how to graphics. A multi-threading graphics tutorial would be PERFECT and I think everything else would fall into place.

I think I'd be able to do what I'm trying to do within a day or so if I were to get the right info. But if I were to get a book, it would take me weeks as I went through the beginner stuff that has nothing to do with what I'm trying to do (input boxes etc stuff I already can figure out on my own)
 
Ok

Ok, let me ask you a few questions. These are very important and you need to know and understand them. This is why I want you to learn some noobie stuff.

Can you build a Property?
Do you know how to inherit from another Class?
Can you add handles to events?
Can you build events?
Do you know how to declare an object by Reference as supposed to By Value?
Do you know the difference between By Reference and By Value?
Can you tell me the Hierarchy of the Forms Class?

Do you know and understand the scope of the variable and why I declared the thread at the top of the class and assigned it in the form load(Even though I could have assigned it at the top, but the reasoning is what I am looking for)?

This may sound stupid but all that goes along way and that's not even the tip of the iceberg. Everyone who's ever programmed can drag and drop controls, set variables, tell you which is which. But there is more to it.

ANyways, here's another sample coding application to get you going.

This one draws a line from the center of the form to wherever the mouse is. I keep useing the mouse b/c I want you to see drawing in realtime and user interaction in realtime.

Build a new Project type Windows Application and set the forms backcolor to black for easy viewing.

Then double click the form, delete the Form Load that the IDE automatically makes and insert this code. Run the program and examine what I have written. THen ask me the questions that you don't understand. And please, ask me everything. I didn't know this stuff either and my Teacher tried to tell me. I just kept programming like I always had and finally I realized I was behind. Code hasn't changed but the way we use it has.

VB.NET:
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] T [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Threading.Thread
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] XY1 [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Point(0, 0)
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] XY2 [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Point(0, 0)
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Mouse_Position [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Point(0, 0)[/SIZE]
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Form1_FormClosing([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2]System.Windows.Forms.FormClosingEventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].FormClosing
     T.Abort()
     T.Join()
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Form1_Load([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2]System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]MyBase[/COLOR][/SIZE][SIZE=2].Load
     Control.CheckForIllegalCrossThreadCalls = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2]   T = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Threading.Thread([/SIZE][SIZE=2][COLOR=#0000ff]AddressOf[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Move_Line)
     T.Priority = Threading.ThreadPriority.BelowNormal
     T.Start()
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Move_Line()
[/SIZE][SIZE=2][COLOR=#0000ff]   Do
[/COLOR][/SIZE][SIZE=2]         XY1 = Mouse_Position
           XY2.X = ([/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Width / 2) : XY2.Y = ([/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Height / 2)
[/SIZE][SIZE=2][COLOR=#0000ff]         Me[/COLOR][/SIZE][SIZE=2].Refresh()
[/SIZE][SIZE=2][COLOR=#0000ff]   Loop
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Protected[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Overrides[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] OnPaintBackground([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Windows.Forms.PaintEventArgs)
[/SIZE][SIZE=2][COLOR=#0000ff]   MyBase[/COLOR][/SIZE][SIZE=2].OnPaintBackground(e)
     e.Graphics.DrawLine(Pens.Aquamarine, XY1, XY2)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Form1_MouseMove([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Windows.Forms.MouseEventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].MouseMove
     Mouse_Position = e.Location
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]
[/COLOR][/SIZE]
 
Last edited:
Looks like I DO need to read the newbie docs

I went ahead and completed a few lesson plans yesterday. I'm actually starting to think VB is fun to play with. I guess I have got some learning to do, luckily I catch on quick because I have 10+ years programming experience :D
 
Right on. Im glad to hear it. Please ask me any questions that you have b/c I may be able to help more and if not the task may be within my reach to help you find the answer. I learn a lot from being on this forum b/c I love to program. When I find lil tasks that I think I can accomplish I teach myself the answers then return with them. Also, I have read several professional programming books and soaked in as much of them as I could. Some I read twice b/c the authors were so great. I would love to share the authors and or send you some books if your interested.
 
Back
Top