views:

182

answers:

2

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

Windows CE 6 / .NET CF 3.5

A: 

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).

ctacke
That worked - thanks. Somewhat related: Is there a property that disables the drawing of the single pixel border around the TabControl?
dkr88
A: 

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);
dkr88