开发者

How to create Windows Mobile 6.5.x finger friendly stock controls?

开发者 https://www.devze.com 2023-01-21 01:16 出处:网络
I\'m developing a Windows Mobile application in C# using .NET Compact Framework 3.5. My target version of WM is 6.5.x. It was my impression that Microsoft has updated the stock controls in this releas

I'm developing a Windows Mobile application in C# using .NET Compact Framework 3.5. My target version of WM is 6.5.x. It was my impression that Microsoft has updated the stock controls in this release of the OS to be more finger friendly (larger fonts, greater space between rows in listboxes, etc.) but when I create, for example, a ListBox-contro开发者_StackOverflow社区l, it looks the same as it did in the previous versions of the OS (stylus friendly).

Do I need to update the style of the controls in order to take advantage of these new finger friendly stock controls? I can't seem to find any documentation on this, however. Or have I misunderstood it; perhaps there are no new controls in WM 6.5.x?


You can get the "new" list view item rendering by sending the list view a LVM_SETEXTENDEDLISTVIEWSTYLE message with both mask and style set to LVS_EX_THEME:

var mask = (IntPtr)LVS_EX_THEME;
var style = (IntPtr)LVS_EX_THEME;

SendMessage(this.listView.Handle, LVM_SETEXTENDEDLISTVIEWSTYLE, mask, style);

You'll need these declarations in one way or another:

[DllImport("coredll.dll", SetLastError = true)]
public static extern Int32 SendMessage(IntPtr hWnd,
                                       Int32 msg,
                                       IntPtr wParam,
                                       IntPtr lParam);

public const Int32
    LVM_FIRST = 0x1000,
    LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54;

public const Int32
    LVS_EX_THEME = 0x02000000;
0

精彩评论

暂无评论...
验证码 换一张
取 消