How to custom the button controls' display style , like CBitmapButton in wince6.0? RRS feed

  • Question

  • Hello everyone,

    How could we custom the button style in WINCE6.0, as give it a image to display?


    Yanbin Yue


    Thursday, April 18, 2013 9:30 AM


All replies

  • You'd either (see

    - Create a owner-drawn button (by specifying the BS_OWNERDRAW style)
    - Use window procedure subclassing and handle all relevant Messages (WM_PAINT, mouse button messages..) yourself.

    There are a good number of samples on CodeProject showing how to create such a bitmap button.
    This ( sample might be helpful to start with.


    MVP Windows Embedded

    • Marked as answer by Yanbin Yue Friday, April 19, 2013 5:42 AM
    Thursday, April 18, 2013 7:09 PM
  • Thanks for your reply.

    Is there only this one method? Handle all Messages ourselves is very complex.....


    Friday, April 19, 2013 3:46 AM
  • If you want to create customized control, every possible approach (owner-draw, custom control, subclassing existing controls) requires a certain level of windows message handling when using native code.

    If using managed code (.NET Compact Framework), things would be ways easier. A sample how to do that can be found here:

    MVP Windows Embedded

    Friday, April 19, 2013 6:59 AM
  • We only could use the native code. So It looks we could only to do this with handling the windows message.

    The button class has drawitem interface and owner-draw property. And how about CProgressCtrl  CScrollBar and so on, which control has not owner-draw property?


    Friday, April 19, 2013 7:31 AM
  • It seams you're using MFC. In this case, the CBitmapButton class is available in the MFC implementation for Windows Embeddded CE (see, You should not need to implement that yourself. 

    For all other controls (CProgressCtrl ...), you'd need to subclass the control (the MFC does that for you) and handle WM_PAINT (override the OnPaint method) plus related messages to get the control state (progress state...) need to properly draw he control. The most complex control to implement is probably the scroll bar.

    Windows Embedded CE also offers a way of skinning the entire UI (see ). If you need to customize more or less every control available, this is something you may want to consider.

    MVP Windows Embedded

    • Marked as answer by Yanbin Yue Monday, April 22, 2013 2:27 AM
    Friday, April 19, 2013 12:49 PM
  • Thanks very a lot.

    I think we do need the skinning way.


    Monday, April 22, 2013 2:29 AM