C#: Wie entferne ich den Tabcontrol-Rahmen?C#

Ein Treffpunkt für C#-Programmierer
Anonymous
 C#: Wie entferne ich den Tabcontrol-Rahmen?

Post by Anonymous »

In meinem Formular verwende ich ein Tab-Steuerelement. Ich möchte die Tab-Überschriften ausblenden und beide umranden. Ich kann beides tun: Wenn ich versuche, die Kopfzeilen auszublenden, wird der Rand sichtbar. Kann mir bitte jemand helfen? Danke und hier ist mein Code:

Code: Select all

public Form3()
{
InitializeComponent();
this.NativeTabControl1 = new NativeTabControl();

this.NativeTabControl1.AssignHandle(this.tabControl1.Handle);

}

private NativeTabControl NativeTabControl1;

private class NativeTabControl : NativeWindow
{
protected override void WndProc(ref Message m)
{
if ((m.Msg == TCM_ADJUSTRECT))
{
RECT rc = (RECT)m.GetLParam(typeof(RECT));
//Adjust these values to suit, dependant upon Appearance
rc.Left -= 3;
rc.Right += 3;
rc.Top -= 3;
rc.Bottom += 3;
Marshal.StructureToPtr(rc, m.LParam, true);
}
base.WndProc(ref m);
}

private const Int32 TCM_FIRST = 0x1300;
private const Int32 TCM_ADJUSTRECT = (TCM_FIRST + 40);
private struct RECT
{
public Int32 Left;
public Int32 Top;
public Int32 Right;
public Int32 Bottom;
}

private void Form3_Load(object sender, EventArgs e)
{
//hides tabcontrol headers
tabControl1.Appearance = TabAppearance.Buttons;
tabControl1.ItemSize = new Size(0, 1);
tabControl1.SizeMode = TabSizeMode.Fixed;
}
}

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post