By Merle Nicholson, President, Tampa PC Users Group
| As all our members know, we have a Visual Basic SIG
thats doing well. Its well attended and interesting. Id like to mention
something to some of the members of that group and anyone else who is just beginning to
have an interest in programming. Here it is, and you can quote me on this. "You have
to do it to learn anything about it". It isnt like going to a history
class where more study improves your performance. Its more like learning to drive.
You can study it forever, but as we all know, 99.9% of the skills you learn is doing the
driving. Id like to present two very recent projects Ive done by way of illustrating some of the useful things you can accomplish with programming. One is an Address Book, and the other is a picture re-size calculator. Im not going to give you any programmer-type language here, just what it does and why I did the projects, so read on. Address Book What this world does NOT need is another address book. Definitely. But I have this project as an aid for the VB classes I teach. Also the address books Ive looked at dont quite fit what Valerie and I use one for. We have this small brown book by the telephone downstairs that has, yes, names and addresses, but also things like peoples birthdays, and when their children graduated from school, and things like what kind of illness their mother has. This way Valerie and I can kind of know what each other knows about people we talk to and send cards to. One thing that it doesnt have though that we need is say the phone number to Ho Hos so we can order carryout, things like that, that would definitely make that little book too complicated. Also, its downstairs. My part of the house is in an upstairs "office". Valeries computer is downstairs, and both are networked to the server, an ideal place to keep a central database. So why not? I revamped the fields some, and added a search field. Note in the picture, the example has "wildflower florist" in it so you can search for either word. Also simply typing in a "w" got to the first record that has a "w" in the first word. The search works just about instantaneously, and the upper right navigation buttons allow you to page through all qualifying entries. In this case all records that start with a "w" in the search field. I deliberately do not search through Last Name, First Name as you would expect. Instead, you must enter some category words in the search field. In the case of personal friends, perhaps starting with the last name, but if you normally refer to a person as "Dan", thats all youd put there. Maybe Ho Hos would be "Ho Chinese food". Notice that there are four telephone entries and two email addresses. Valerie and I have four telephone numbers between us, not counting the modem phone, so for version 2, Im considering just a free-form box for telephone numbers. Weve just begun putting all the "little book" entries in, and by the time were done, I may have changed the appearance completely. Also I may give it a way to address envelopes and also some way to go through and check off about thirty entries to do Christmas envelopes. It may just be a Word Basic program instead that accesses the database independently. Well see. In my household a program is never done. |
![]() |
PixCalc This is one that I really had fun with. It took about three or four hours to program, and it takes a bit of explaining. When I got Paint Shop Pro 5, I discovered a new (for version 5) feature. It shows any picture with a ruler on it, showing the size of the picture in inches. And Im REALLY interested in this, because I want to place these pictures on the printed page. I want to print a picture out say as a 5 by 7 or 8 by 10, or I may want to place six small pictures on a single page. If you "scale" a picture you must maintain an "aspect ratio" to keep the picture from being elongated or distorted. So how does a picture that is 5.389 by 2.750 at 72 pixels per inch fit into a 5 by 7, or 7 by 5? Probably not too well unless you do some accurate calculations. Ive been doing this with a calculator for a while. And its just a simple matter of proportions, some straightforward algebra. But its tedious, and many times you must do it a number of times to decide what to do. As you increase the size, one dimension or the other will meet the target dimension, but the other wont if you maintain the original aspect ratio. So you need to know the final dimension, and sometimes you want to know how may pixels to add left and right or top and bottom, so you can sometimes add a border to fill out to the required dimensions. Some experimentation shows that the initial size in inches is determined by the resolution in pixels, at 72 pixels per inch. Now lets say if its high resolution you dont just want to scale the picture and maintain 72 pixels per inch. What you really want to do is increase the pixels per inch to reduce the physical size so that either the width or height meet the target printed size. And this little baby does all that all by typing in the initial size in inches and the pixels in inches. Paint Shop Pro gives you this on the Image, Resize panel. That automatically fills in the Initial Pixels. Sometimes because of round off error, those two pixel numbers may need changing by one or two, and you can do that. Then you fill in the Target Width and Height and automatically, the new (Final) Pixels/In and the Final Width and Height are calculated. Internally, a judgement must be made about which dimension is reached first. In the example shown, the height target was met, and the width was not. Its short of meeting that target by .73 inches. And if you were to add 73 pixels on the left and 74 pixels on the right, the picture will be exactly 7 by 5. In Paint Shop Pro, you can add borders like this in any color you like. Doing it in white just makes it easier to center the 7 by 5 on the printed page. All you need to do is plug the Final Resolution number in PSPs Image, Resize panel, and itll print exactly the correct size. |
![]() |
| Thats it! Except for the About panel, which Im showing here also. The System Info is interesting, I think. Its the same one that you see on the About panel in MS Word. This About panel was made from a Wizard in Visual Basic, with some modifications. If youre interested in this program, Ill be happy to send it to you by email. The only catch is if you have the Visual Basic 5 product, you dont want this. Its written in VB 6, and the files play havoc with a VB 5 compiler product. As do ALL VB 6 programs. Theres no problem otherwise to everyone else. Send me email at merlenic@tampabay.rr.com and indicate if you want the source code also. u | ![]() |