1

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

Windows CE 6 / .NET CF 3.5

Jon Seigel
  • 12,251
  • 8
  • 58
  • 92
dkr88
  • 504
  • 1
  • 5
  • 15

2 Answers2

0

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
  • 66,480
  • 18
  • 94
  • 155
  • That worked - thanks. Somewhat related: Is there a property that disables the drawing of the single pixel border around the TabControl? – dkr88 Mar 16 '10 at 18:44
0

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
  • 504
  • 1
  • 5
  • 15