Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » centering of the bitmap on the button - how to disable this feature? Collapse All
Subject Author Date
Chris Anderson Jan 31, 2008 - 3:27 PM

hi,

is it possible to change the way a bitmap is painted on a button ( CExtButton ) when the bitmap of a button ( m_icon ) has a larger size than the button. Currently prof-uis automatically centers the bitmap on the button ( we use prof-uis v282 )

CExtPaintManagerXP::PaintIcon(...)
{
....

        if(    ( _sizeIcon.cy + rcIconMargins.top + rcIconMargins.bottom ) > rcClient.Height() )
        {
            nIconAlignment &= ~__ALIGN_VERT_MASK;
            nIconAlignment |= __ALIGN_VERT_CENTER;
        }

...

        else if( (nIconAlignment&__ALIGN_VERT_MASK) == __ALIGN_VERT_CENTER )
        {
            rcIconLocation.OffsetRect( 0, ( rcClient.bottom - rcIconLocation.bottom ) / 2 + rcIconMargins.top - rcIconMargins.bottom );
        }

Now only the central portion will be painted : i.e. if the m_icon is a bitmap with a height of 100, and the button has a height of 50. Only the 25 - 75 portion of the bitmap will be displayed ( ignore the margin ).

how to disable this feature and make sure the top left corner of the bitmap always show up in the button ?

Thanks

Technical Support Feb 2, 2008 - 11:18 AM

You can find all the alignments and margins supported by button control in the ProfUIS_Controls sample (the Buttons page) . The button control can be painted as a colored rectangle with a single pixel border in one theme and as a bitmap based skin with a wide skinned border in other theme. We assume that button icons should be less than a button at least by two or three pixels. We can change the centering behavior for the button icon but in any case the icon that is larger than a button will have incorrect look under the most of themes. It would be extremely interesting to know more details about the button controls in your real project which need larger icons.

Chris Anderson Feb 4, 2008 - 10:16 AM

thanks for the information. Since our app allows the user to attach a bitmap to a button on the fly, there is a good chance the bitmap may be larger than the button. My solution is crop the bitmap to make sure this won’t happen. Now it works.