
Originally Posted by
LaVolpe
The CustomButton template is just that: a template. It was designed to replicate a VB button's actions, it does not include usable code to draw the caption, icons, or anything else related to the display of the button. Some drawing code is provided for example purposes only. Why? These routines cannot be easily provided in a template because some users may want captions aligned one way or the other, support unicode or not, allow caption-less/image-only buttons, and a myriad of other scenarios. The button's display is your responsibility, the button's actions are mine.
I think that if you want to create your own custom button, this template is a perfect starting point. It does all the hard work of making the button responsive to the user and to the coder. I have attempted to replicate the VB button's actions exactly and believe I have done it 100%, or at least 99.9%. Events are fired in the same order as VB's button, overridable event parameters are supported same as VB's button, and in the case of MouseEnter/MouseLeave events, I used my own logic since VB buttons don't provide these.
There are 2 CustomButton templates. The one with the project has minimal drawing routines added to it so that it can be used with the sample project and is for the sample project only. It is derived from the raw template. The other, in the ResuableTemplate folder, is the raw template.
You can even add the raw template (.ctl file) to your VB templates folder [C:\Program Files\Microsoft Visual Studio\VB98\Template\Userctls]. And it will appear when you opt to Add|User Control from your project tree/explorer.