CompuServe Thread

#faster FRAME routine

4 messages in this thread
#2176From: paul bonnerOct 9, 1991 9:41 AM
I liked the VBTIPS viewer so much I started playing around with its FRAME routine for a project of my own. I discovered you can speed up FORM.SHOW commands considerably by putting all the controls that you want to FRAME on top of a Frame control which is covered entirely by a Picture control, and then changing the form's PAINT routine to something like: IF PICTURE1.AUTODRAW=TRUE THEN EXIT SUB PICTURE1.AUTODRAW=TRUE CALL PicFrame(FORM.PictureControl, ControlToFrame) This ensures that the frame will be drawn only the first time that the form is displayed. On subsequent repainting of the form the already-drawn frame will be shown. The PicFrame routine differs from your FRAME routine only in that defines F AS CONTROL rather than F AS FORM in its parameter list. One caveat–listboxes don't seem to always refresh reliably using this method (AUTODRAW=TRUE). Thus it may be necessary to include a LISTOBOX.REFRESH command at the beginning of the FORM.PAINT statement. There are 2 Replies.
#2177From: paul bonnerOct 9, 1991 9:44 AM
The three lines of code in my previous message should read: IF PICTURE1.AUTODRAW=TRUE THEN EXIT SUB PICTURE1.AUTODRAW = TRUE CALL PicFrame(FORM1.PictureControl, ControlToFrame)
#2403From: Nelson FordOct 10, 1991 9:50 AM
You lost me on that. What is the point of putting all the controls inside both a Frame and a Paint box? There is 1 Reply.
#2427From: paul bonnerOct 10, 1991 11:48 AM
You're right, I sort of backed into the solution and ended up doing more than was necessary. All you really need to do is put the ctrols inside a Picture box–the frame isn't needed. The Picture box lets you set AutoDraw to TRUE, eliminating the need to redraw the Framing lines everytime the form is painted.