Yep. I'm glad you asked *smile*
Instead of starting from scratch, I figured the right approach would be to capitalize on work done by others. And by taking that approach, I found an article at http://knol.google.com/k/creating-custom-controls-with-c-net# which made my job easy. The article spells out how to create a custom progress bar for your application. Seems like something useful huh?
First I created the same project using the same name, but instead of C#, I selected to create a managed COBOL Windows Forms Application (didn't want to strain too much by thinking too hard too soon of course).
I then added the reference to the new project as directed and was ready to create the control. As with the C# example, Visual COBOL created a shell class program for me to use as a base. And as in the example, I deleted it because I wouldn’t be using it.
From the Solution Explorer, I selected the ProgressBar project and right clicked to Add a new item, selected “User Control” from the menu and named it “ProgressControl”.
- BackColor: Window
- BorderStyle: FixedSingle
- Size: 148, 14
- Double-Buffered: True
Since I used COBOL, you’ll notice the code behind page that was created for the ProgressControl is very similar to the C# version.
The biggest difference is that I had to write a bit more code for the get and set methods than what the C# had. Not much, but I had to spell out each method, along with its own working storage, procedure division, etc.
Again, you’ll notice that I used COMP-1 when defining the field that is to be used as a short Float. The last bit of code looks like this:
Of course I left out all the mistakes I made trying to decipher the C#, but I never claimed to be a C# programmer now did I? That’s what I call my buddy Mike for. *smile*
Hopefully you find this of interest / value. If you find any errors in my code or suggestions on how to make this better, by all means, please share! All contributions greatly appreciated!