为.NET CF 中的TabControl控件添加WM6.5效果
2010-03-08 15:39
411 查看
WM6.5中的TabControl拥有了全新的界面,但是在.NET CF中的控件仍然是老面孔,很不好看。在这里贴一个老外的解决方法,很简洁:
// In The Hand - .NET Components for Mobility
//
// InTheHand.WindowsMobile.Forms.TabControlHelper
//
// Copyright (c) 2009 In The Hand Ltd, All rights reserved.
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace InTheHand.WindowsMobile.Forms
{
///
/// Provides helper methods for the on Windows Mobile 6.5.
///
public static class TabControlHelper
{
[DllImport("coredll")]
private static extern int GetWindowLong(IntPtr hwnd, int nIndex);
private const int GWL_STYLE = -16;
[DllImport("coredll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("coredll")]
internal static extern IntPtr GetWindow(IntPtr hWnd, int uCmd);
private const int GW_CHILD = 5;
private const int TCS_TOOLTIPS = 0x4000;
///
/// Updates the selected with the Windows Mobile 6.5 style.
///
///
public static void EnableVisualStyle(TabControl tabControl)
{
//get handle of native control
IntPtr hNativeTab = GetWindow(tabControl.Handle, GW_CHILD);
//get current style flags
int style = GetWindowLong(hNativeTab, GWL_STYLE);
//add tooltips style
style = SetWindowLong(hNativeTab, GWL_STYLE, style | 0x4000);
}
}
}
// In The Hand - .NET Components for Mobility
//
// InTheHand.WindowsMobile.Forms.TabControlHelper
//
// Copyright (c) 2009 In The Hand Ltd, All rights reserved.
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace InTheHand.WindowsMobile.Forms
{
///
/// Provides helper methods for the on Windows Mobile 6.5.
///
public static class TabControlHelper
{
[DllImport("coredll")]
private static extern int GetWindowLong(IntPtr hwnd, int nIndex);
private const int GWL_STYLE = -16;
[DllImport("coredll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("coredll")]
internal static extern IntPtr GetWindow(IntPtr hWnd, int uCmd);
private const int GW_CHILD = 5;
private const int TCS_TOOLTIPS = 0x4000;
///
/// Updates the selected with the Windows Mobile 6.5 style.
///
///
public static void EnableVisualStyle(TabControl tabControl)
{
//get handle of native control
IntPtr hNativeTab = GetWindow(tabControl.Handle, GW_CHILD);
//get current style flags
int style = GetWindowLong(hNativeTab, GWL_STYLE);
//add tooltips style
style = SetWindowLong(hNativeTab, GWL_STYLE, style | 0x4000);
}
}
}
相关文章推荐
- VB.NET 仿Edge风格的TabControl控件
- WIN SDK 添加Tab控件 List Control with CheckBox
- 添加Tab Control控件
- 如何去掉TabControl控件默认添加的TabPage
- 对tabcontrol控件增强,添加关闭按钮功能、呼吸灯标签闪烁功能、类QQ消息数量标签提示TIP
- 给所有的Control添加发送键盘事件Tab事件,实现回车键自动跳转到下一个控件
- MFC入门学习之控件(3)标签控件Tab Control的添加和使用
- winform如何用tabControl控件实现纵向选项卡效果?
- Asp.Net Web控件 (八)(TabControl 选项卡控件)
- 如何去掉TabControl控件默认添加的TabPage
- 如何给C# 中的tabControl 控件添加图片
- 让.NET CF的TabControl控件支持WM6.5风格
- 动态添加AjaxControl Toolkit的Tab控件及设置模板
- MFC中 使用Tab Control 控件在对话框中添加属性页
- VB.net对于datagride控件的使用及C#中datagrideView\bindingSource\bindingNavigator\tabcontrol控件的应用
- Asp.Net Web控件TabControl 选项卡控件
- ASP.NET2.0中Tabs的简单实现 不用Asp.net Ajax ControlToolKit中的Tabs控件实现Tabs效果的简单实现方法:
- 利用Menu和MutiView控件实现类似tabControl效果
- Asp.Net Web控件 (八)(TabControl 选项卡控件)
- 利用Menu和MutiView控件实现类似tabControl效果