Ok, so I am writing an interface to an existing program. This program serves 1 purpose, to display data.
It consists of a form, with 96 bitmaps, and 48 textboxes. I initialize the entire form by doing the following:
I loop through each bitmap, and create an array of pointers to it.
Public pDIOBox(96) as picturebox ' Declared in a Global Module
Then I go through a loop, and set each object in pDIOBox to equal a picturebox on the page. Then in another function I manipulate these objects.
For i = 1 to 96
pDIOBox(i) = SomePictureBoxOnPage
Later I manipulate them from another class/form.
pDIOBox(i).Image = SomeImageFile
See, the pictureboxes exist as controls in 1 form's class. They are manipulated by a function in several other classes. So, to gain access to them I had to create pointers to them from a globally accessible location.
Perhaps a better way exists?
Anyways, every 25ms my thread updates these objects based off a datafile. I find changing the properties on these controls to be EXCESSIVELY CPU intensive.
Changing the picturebox.image property for 96 pictureboxes every 25ms takes > 90% of the CPU.
Similarly, changing the Textbox.Text propery for 48 textboxes every 25ms uses > 90% of the CPU.
Combined, the program fails to work within the given time constraints, as the CPU is thrashing. This is on a 3Ghz P4 for reference.
Any ideas how I can cut down the resources being consumed by my program? Thank you in advance.
It consists of a form, with 96 bitmaps, and 48 textboxes. I initialize the entire form by doing the following:
I loop through each bitmap, and create an array of pointers to it.
Public pDIOBox(96) as picturebox ' Declared in a Global Module
Then I go through a loop, and set each object in pDIOBox to equal a picturebox on the page. Then in another function I manipulate these objects.
For i = 1 to 96
pDIOBox(i) = SomePictureBoxOnPage
Later I manipulate them from another class/form.
pDIOBox(i).Image = SomeImageFile
See, the pictureboxes exist as controls in 1 form's class. They are manipulated by a function in several other classes. So, to gain access to them I had to create pointers to them from a globally accessible location.
Perhaps a better way exists?
Anyways, every 25ms my thread updates these objects based off a datafile. I find changing the properties on these controls to be EXCESSIVELY CPU intensive.
Changing the picturebox.image property for 96 pictureboxes every 25ms takes > 90% of the CPU.
Similarly, changing the Textbox.Text propery for 48 textboxes every 25ms uses > 90% of the CPU.
Combined, the program fails to work within the given time constraints, as the CPU is thrashing. This is on a 3Ghz P4 for reference.
Any ideas how I can cut down the resources being consumed by my program? Thank you in advance.