When I set TabControl alignment to Left
or Right
it leaves this huge space between tab buttons and tab page area. How to get rid of this useless space?
TabControl.Appearance
is set to Buttons
because if it is set to Normal
the text on buttons disappear.
UPDATE:
When i set TabControl.Alignment
to Bottom
and TabControl.Appearance
to Normal
buttons look inverted (orange line should be below)
When i set TabControl.Alignment
to Bottom
and TabControl.Appearance
to Buttons
, There is no area on TabPage
to place controls
This is a well-known problem with the XP visual style implementation for the native tab control, only tabs aligned to the top render properly. This bug hasn't been addressed until Windows 7. The workaround is to selectively turn off the style. Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto your form and change the Alignment property to your liking. It isn't going to look prettier than that.
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
class FixedTabControl : TabControl {
protected override void OnHandleCreated(EventArgs e) {
SetWindowTheme(this.Handle, "", "");
base.OnHandleCreated(e);
}
[DllImportAttribute("uxtheme.dll")]
private static extern int SetWindowTheme(IntPtr hWnd, string appname, string idlist);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With