QA: How to create a spin control like in Microsoft programs?

Vassili Philippov (vasja@spbteam.com), November 26, 2003.

Question

In standard Pocket PC applications spin control has special Pocket PC look and feel. How can I create the same looking spin control?

Answer

If you create a spin control and attach it to an edit box it will look like:

But in standard Pocket PC applications it looks like:

which is much better for Pocket PC.

Two accomplish the same style you should make two things. First you should change spin orientation from vertical to horizontal:

After that your spin control will look like:

The second you should send CCM_SETVERSION message to the spin control with wParam=COMCTL32_VERSION. You can do it for example in WM_INITDIALOG message handler:

::SendDlgItemMessage(m_hWnd, IDC_SPIN1, CCM_SETVERSION, COMCTL32_VERSION, 0);

That's all. Now your spin control has standard (but undocumented) look and feel:

Related resources: