what we have | what we want |
![]() |
![]() |
Idea:
The style of picture button in powerbuilder is BS_OWNERDRAW. The owner window or userobject receives a WM_MEASUREITEM message when the button is created and a WM_DRAWITEM message when a visual aspect of the button has changed.
We can trigger WM_DRAWITEM event for the owner window (or userobject) to draw a picture button into our bitmap (not to the screen).
Now we can convert a bitmap to an icon, then change the style of the picturebutton from BS_OWNERDRAW to BS_ICON, and set this icon to be displayed in our picturebutton.
We need an Icon to be sure that disabled icon will be shown in a right way.
I found some limitation. It depends on operation system, video card, etc. The creation of large size icons will fail. I found this limitation for windows 98. The maximum size of the icon ~ 30000 points. 300 x 100 pixels.
n_picture_masker.sru
This object is autoinstantiated so you don't need to create and destroy it.
It have only two public methods:
boolean f_SetMask(pictureObject) //converts usual picturebutton to icon button boolean f_Reset(pictureObject) //converts icon button back to picturebutton where pictureObject can be Picture or PictureButton
Copyright by Dmitry Lukyanov