Nine Patch PNGs for VB6
NPPNG project includes cNinePatch.cls
for 9-patch parsing/handling and ctxNineButton.ctl
custom user-control for transparent animated buttons with states based on 9-patches.
Just include src/cNinePatch.cls
in your projects to be able to load and draw 9-patches in user-defined sizes.
Add src/ctxNineButton.ctl
and src/mdNineButton.bas
for the transparent windowless button control, with states based on nine-patches.
In ctxNineButton
you can set conditional compilation constant ImplHasTimers
to False
to disable control state-transition animations. In this case src/mdNineButton.bas
will not be depended on anymore and the control becomes self-contained in src/ctxNineButton.ctl
.
State | Description |
---|---|
ucsBstNormal |
Normal state |
ucsBstHover |
Optional mouse hover. Otherwise ucsBstNormal is used |
ucsBstPressed |
Optional mouse pressed. Otherwise ucsBstHover is used |
ucsBstHoverPressed |
Optional mouse pressed over the control. Otherwise ucsBstPressed is used |
ucsBstDisabled |
Optional disabled state |
ucsBstFocused |
Optional focus rectangle which is composited before current state |
Each state can have a different 9-patch image, text and shadow properties.
Property | Description |
---|---|
ButtonImageArray |
Nine-patch image as byte array |
ButtonImageOpacity |
Image transparency incl. composited text and shadow |
ButtonTextFont |
Text font |
ButtonTextFlags |
Text alignment and wrapping |
ButtonTextColor |
Text color |
ButtonTextOpacity |
Text transparency on image before applying image transparency |
ButtonTextOffsetX |
Additional text horizontal offset after alignment |
ButtonTextOffsetY |
Additional text vertical offset after alignment |
ButtonShadowColor |
Text shadow color |
ButtonShadowOpacity |
Text shadow transparency on image |
ButtonShadowOffsetX |
Shadow horizontal offset from text |
ButtonShadowOffsetY |
Shadow vertical offset from text |
Property | Description |
---|---|
AnimationDuration |
Duration of state transition (in seconds) |
Opacity |
Global control transparency |
Enabled |
Uses disabled state settings to paint control |