Set tab control style on managed TabControl

爷,独闯天下 提交于 2019-12-11 05:41:17

问题


Is it possible to set a tab control style like TSC_BUTTONS on a managed TabControl?

Windows CE 6 / .NET CF 3.5


回答1:


With the caveat that I'm not specifically done this style change (though I've done plenty of others), according to the docs TCS_BUTTONS is a supported style. Since the managed TabControl is simply a wrapper around the native one, you should be able to P/Invoke SetWindowLong with GWL_STYLE and adjust this (probably in the constructor of a TabControl-derived custom control).




回答2:


Here's a solution:

const int GWL_STYLE = -16;
const long TSC_BUTTONS = 0x0100;

[DllImport("coredll.dll")]
static extern void SetWindowLong(IntPtr ptr, int index, long value);

// In constructor:
SetWindowLong(this.Handle, GWL_STYLE, TSC_BUTTONS);


来源:https://stackoverflow.com/questions/2456720/set-tab-control-style-on-managed-tabcontrol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!