问题
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