Okay, thanks for your help.
I just have seen that most people, including even in this community, frown upon retrieving a variable via a string (its name). I figured the same would apply here. But I guess in some cases it is acceptable for such behavior, especially when it would simplify the code so greatly.
User Profile
Collapse
-
Nothing in particular, wouldn't it just slow it down? It seems a little excessive...get ting a method name from a file, passing the string to look up a symbol name of the very program you're running in currently...whe n all you really need to do (though it might be uglier) is just call the damn method in the program. I was merely trying to look for a non-ugly way, maybe, avoiding reflection.
Thanks for being patient with me.Leave a comment:
-
That would be fine, I don't care what the methods are named....but even then, how would I go about matching up that byte coming in to that function named "2A"? Do I have to resort to reflection?Leave a comment:
-
You are pretty much correct. I will have hundreds of methods, which is why I chose a delegate system as I don't want this:
Code:switch (code) { case 0x28: RunADD(); break; case 0x2A: RunJMP(); break; //so on... }
Leave a comment:
-
Design Question
Okay so I've got a delegate called "InstructionRun " (just a simple void with no parameters), and a class called "Instructio n" which contains a delegate InstructionRun object as a member variable, as well as a method called "Run" which just calls the InstructionRun object's current functionality. There is also a byte in this class called "code".
Another class ("Instructions" ) has a... -
I just went down to the byte level of the image instead of the sluggish Get and SetPixel(), and now it works much faster. If anyone wants help with how I did this, feel free to ask.Leave a comment:
-
Changing the actual pixels of the picturebox's image is very rigid, but also very sluggish. I'd rather use the Draw methods of the Graphics class, but I'm still having problems with redrawing. Any ideas to get it close to as rigid as changing the actual pixels?
Any more help would be appreciated,
ScottLeave a comment:
-
Thanks for the advice.
It's weird now. Now it does redraw, but only when I move the Notepad window slowly enough. If I move it fast, it never comes back.Leave a comment:
-
C# PictureBox Help
I have a PictureBox that draws an image and then a rectangle. However, annoyingly, any other window that I put over the rectangle causes it not to redraw. (I can cut out half of the rectangle by opening Notepad and placing it over half of it, or all of it by minimizing and then maximizing)
Here is my code:
Code:private void Refresh_PictureBox() { Graphics g = pictureBox1.CreateGraphics();
No activity results to display
Show More
Leave a comment: